Skip to content

Commit

Permalink
Use SAL2 _In_, _Out_ to prevent conflicts (dotnet#63261)
Browse files Browse the repository at this point in the history
  • Loading branch information
NN--- authored Jan 3, 2022
1 parent 046cbf0 commit 9472bfe
Show file tree
Hide file tree
Showing 112 changed files with 896 additions and 908 deletions.
34 changes: 17 additions & 17 deletions src/coreclr/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
}

HRESULT
ConvertUtf8(__in LPCUTF8 utf8,
ConvertUtf8(_In_ LPCUTF8 utf8,
ULONG32 bufLen,
ULONG32* nameLen,
__out_ecount_part_opt(bufLen, *nameLen) PWSTR buffer)
Expand Down Expand Up @@ -228,7 +228,7 @@ GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
}

HRESULT
SplitFullName(__in_z __in PCWSTR fullName,
SplitFullName(__in_z _In_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 memberDots,
__deref_out_opt LPUTF8* namespaceName,
Expand Down Expand Up @@ -401,7 +401,7 @@ SplitFullName(__in_z __in PCWSTR fullName,
}

int
CompareUtf8(__in LPCUTF8 str1, __in LPCUTF8 str2, __in ULONG32 nameFlags)
CompareUtf8(_In_ LPCUTF8 str1, _In_ LPCUTF8 str2, _In_ ULONG32 nameFlags)
{
if (nameFlags & CLRDATA_BYNAME_CASE_INSENSITIVE)
{
Expand Down Expand Up @@ -7565,9 +7565,9 @@ typedef struct _WER_RUNTIME_EXCEPTION_INFORMATION
// else detailed error code.
//
//----------------------------------------------------------------------------
STDAPI OutOfProcessExceptionEventGetWatsonBucket(__in PDWORD pContext,
__in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
__out GenericModeBlock * pGMB)
STDAPI OutOfProcessExceptionEventGetWatsonBucket(_In_ PDWORD pContext,
_In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
_Out_ GenericModeBlock * pGMB)
{
HANDLE hProcess = pExceptionInformation->hProcess;
HANDLE hThread = pExceptionInformation->hThread;
Expand Down Expand Up @@ -7656,12 +7656,12 @@ STDAPI OutOfProcessExceptionEventGetWatsonBucket(__in PDWORD pContext,
// Since this is called by external modules it's important that we don't let any exceptions leak out (see Win8 95224).
//
//----------------------------------------------------------------------------
STDAPI OutOfProcessExceptionEventCallback(__in PDWORD pContext,
__in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
__out BOOL * pbOwnershipClaimed,
STDAPI OutOfProcessExceptionEventCallback(_In_ PDWORD pContext,
_In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
_Out_ BOOL * pbOwnershipClaimed,
__out_ecount(*pchSize) PWSTR pwszEventName,
__inout PDWORD pchSize,
__out PDWORD pdwSignatureCount)
_Out_ PDWORD pdwSignatureCount)
{
SUPPORTS_DAC_HOST_ONLY;

Expand Down Expand Up @@ -7748,9 +7748,9 @@ STDAPI OutOfProcessExceptionEventCallback(__in PDWORD pContext,
// Since this is called by external modules it's important that we don't let any exceptions leak out (see Win8 95224).
//
//----------------------------------------------------------------------------
STDAPI OutOfProcessExceptionEventSignatureCallback(__in PDWORD pContext,
__in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
__in DWORD dwIndex,
STDAPI OutOfProcessExceptionEventSignatureCallback(_In_ PDWORD pContext,
_In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
_In_ DWORD dwIndex,
__out_ecount(*pchName) PWSTR pwszName,
__inout PDWORD pchName,
__out_ecount(*pchValue) PWSTR pwszValue,
Expand Down Expand Up @@ -7873,12 +7873,12 @@ STDAPI OutOfProcessExceptionEventSignatureCallback(__in PDWORD pContext,
// this function are of the pwszName and pwszValue buffers.
//
//----------------------------------------------------------------------------
STDAPI OutOfProcessExceptionEventDebuggerLaunchCallback(__in PDWORD pContext,
__in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
__out BOOL * pbCustomDebuggerNeeded,
STDAPI OutOfProcessExceptionEventDebuggerLaunchCallback(_In_ PDWORD pContext,
_In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
_Out_ BOOL * pbCustomDebuggerNeeded,
__out_ecount_opt(*pchSize) PWSTR pwszDebuggerLaunch,
__inout PDWORD pchSize,
__out BOOL * pbAutoLaunchDebugger)
_Out_ BOOL * pbAutoLaunchDebugger)
{
SUPPORTS_DAC_HOST_ONLY;

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/daccess/dacfn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ DacExceptionFilter(Exception* ex, ClrDataAccess* access,
}

void __cdecl
DacWarning(__in char* format, ...)
DacWarning(_In_ char* format, ...)
{
char text[256];
va_list args;
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/debug/daccess/dacimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct METH_EXTENTS
CLRDATA_ADDRESS_RANGE extents[1];
};

HRESULT ConvertUtf8(__in LPCUTF8 utf8,
HRESULT ConvertUtf8(_In_ LPCUTF8 utf8,
ULONG32 bufLen,
ULONG32* nameLen,
__out_ecount_part_opt(bufLen, *nameLen) PWSTR buffer);
Expand All @@ -247,15 +247,15 @@ enum SplitSyntax
SPLIT_NO_NAME,
};

HRESULT SplitFullName(__in_z __in PCWSTR fullName,
HRESULT SplitFullName(__in_z _In_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 memberDots,
__deref_out_opt LPUTF8* namespaceName,
__deref_out_opt LPUTF8* typeName,
__deref_out_opt LPUTF8* memberName,
__deref_out_opt LPUTF8* params);

int CompareUtf8(__in LPCUTF8 str1, __in LPCUTF8 str2, __in ULONG32 nameFlags);
int CompareUtf8(_In_ LPCUTF8 str1, _In_ LPCUTF8 str2, _In_ ULONG32 nameFlags);

#define INH_STATIC \
(CLRDATA_VALUE_ALL_KINDS | \
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/di/publish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ HRESULT CorpubProcess::GetDisplayName(ULONG32 cchName,
// CorpubAppDomain
// ******************************************

CorpubAppDomain::CorpubAppDomain (__in LPWSTR szAppDomainName, ULONG Id)
CorpubAppDomain::CorpubAppDomain (_In_ LPWSTR szAppDomainName, ULONG Id)
: CordbCommonBase (0, enumCorpubAppDomain),
m_pNext (NULL),
m_szAppDomainName (szAppDomainName),
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/di/rspriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -10838,7 +10838,7 @@ class CorpubProcess : public CordbCommonBase, public ICorPublishProcess
class CorpubAppDomain : public CordbCommonBase, public ICorPublishAppDomain
{
public:
CorpubAppDomain (__in LPWSTR szAppDomainName, ULONG Id);
CorpubAppDomain (_In_ LPWSTR szAppDomainName, ULONG Id);
virtual ~CorpubAppDomain();

#ifdef _DEBUG
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/debug/di/shimcallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ HRESULT ShimProxyCallback::DebuggerError(ICorDebugProcess * pProcess, HRESULT er


// Implementation of ICorDebugManagedCallback::LogMessage
HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, __in LPWSTR pLogSwitchName, __in LPWSTR pMessage)
HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, _In_ LPWSTR pLogSwitchName, _In_ LPWSTR pMessage)
{
m_pShim->PreDispatchEvent();
class LogMessageEvent : public ManagedEvent
Expand Down Expand Up @@ -695,7 +695,7 @@ HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebug


// Implementation of ICorDebugManagedCallback::LogSwitch
HRESULT ShimProxyCallback::LogSwitch(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, ULONG ulReason, __in LPWSTR pLogSwitchName, __in LPWSTR pParentName)
HRESULT ShimProxyCallback::LogSwitch(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, ULONG ulReason, _In_ LPWSTR pLogSwitchName, _In_ LPWSTR pParentName)
{
m_pShim->PreDispatchEvent();
class LogSwitchEvent : public ManagedEvent
Expand Down Expand Up @@ -1060,7 +1060,7 @@ HRESULT ShimProxyCallback::FunctionRemapOpportunity(ICorDebugAppDomain * pAppDom


// Implementation of ICorDebugManagedCallback2::CreateConnection
HRESULT ShimProxyCallback::CreateConnection(ICorDebugProcess * pProcess, CONNID dwConnectionId, __in LPWSTR pConnectionName)
HRESULT ShimProxyCallback::CreateConnection(ICorDebugProcess * pProcess, CONNID dwConnectionId, _In_ LPWSTR pConnectionName)
{
m_pShim->PreDispatchEvent();
class CreateConnectionEvent : public ManagedEvent
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/debug/di/shimpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ class ShimProxyCallback :
COM_METHOD LogMessage( ICorDebugAppDomain *pAppDomain,
ICorDebugThread *pThread,
LONG lLevel,
__in LPWSTR pLogSwitchName,
__in LPWSTR pMessage);
_In_ LPWSTR pLogSwitchName,
_In_ LPWSTR pMessage);

COM_METHOD LogSwitch( ICorDebugAppDomain *pAppDomain,
ICorDebugThread *pThread,
LONG lLevel,
ULONG ulReason,
__in LPWSTR pLogSwitchName,
__in LPWSTR pParentName);
_In_ LPWSTR pLogSwitchName,
_In_ LPWSTR pParentName);

COM_METHOD CreateAppDomain(ICorDebugProcess *pProcess,
ICorDebugAppDomain *pAppDomain);
Expand Down Expand Up @@ -178,7 +178,7 @@ class ShimProxyCallback :
ICorDebugFunction *pNewFunction,
ULONG32 oldILOffset);

COM_METHOD CreateConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId, __in LPWSTR pConnName);
COM_METHOD CreateConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId, _In_ LPWSTR pConnName);

COM_METHOD ChangeConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId );

Expand Down
82 changes: 41 additions & 41 deletions src/coreclr/dlls/dbgshim/dbgshim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ if it exists, it will:
DLLEXPORT
HRESULT
CreateProcessForLaunch(
__in LPWSTR lpCommandLine,
__in BOOL bSuspendProcess,
__in LPVOID lpEnvironment,
__in LPCWSTR lpCurrentDirectory,
__out PDWORD pProcessId,
__out HANDLE *pResumeHandle)
_In_ LPWSTR lpCommandLine,
_In_ BOOL bSuspendProcess,
_In_ LPVOID lpEnvironment,
_In_ LPCWSTR lpCurrentDirectory,
_Out_ PDWORD pProcessId,
_Out_ HANDLE *pResumeHandle)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -140,7 +140,7 @@ CreateProcessForLaunch(
DLLEXPORT
HRESULT
ResumeProcess(
__in HANDLE hResumeHandle)
_In_ HANDLE hResumeHandle)
{
PUBLIC_CONTRACT;
if (ResumeThread(hResumeHandle) == (DWORD)-1)
Expand All @@ -159,7 +159,7 @@ ResumeProcess(
DLLEXPORT
HRESULT
CloseResumeHandle(
__in HANDLE hResumeHandle)
_In_ HANDLE hResumeHandle)
{
PUBLIC_CONTRACT;
if (!CloseHandle(hResumeHandle))
Expand Down Expand Up @@ -190,7 +190,7 @@ HRESULT
GetContinueStartupEvent(
DWORD debuggeePID,
LPCWSTR szTelestoFullPath,
__out HANDLE *phContinueStartupEvent);
_Out_ HANDLE *phContinueStartupEvent);

#endif // TARGET_UNIX

Expand Down Expand Up @@ -697,10 +697,10 @@ StartupHelperThread(LPVOID p)
DLLEXPORT
HRESULT
RegisterForRuntimeStartup(
__in DWORD dwProcessId,
__in PSTARTUP_CALLBACK pfnCallback,
__in PVOID parameter,
__out PVOID *ppUnregisterToken)
_In_ DWORD dwProcessId,
_In_ PSTARTUP_CALLBACK pfnCallback,
_In_ PVOID parameter,
_Out_ PVOID *ppUnregisterToken)
{
return RegisterForRuntimeStartupEx(dwProcessId, NULL, pfnCallback, parameter, ppUnregisterToken);
}
Expand Down Expand Up @@ -738,11 +738,11 @@ RegisterForRuntimeStartup(
DLLEXPORT
HRESULT
RegisterForRuntimeStartupEx(
__in DWORD dwProcessId,
__in LPCWSTR lpApplicationGroupId,
__in PSTARTUP_CALLBACK pfnCallback,
__in PVOID parameter,
__out PVOID *ppUnregisterToken)
_In_ DWORD dwProcessId,
_In_ LPCWSTR lpApplicationGroupId,
_In_ PSTARTUP_CALLBACK pfnCallback,
_In_ PVOID parameter,
_Out_ PVOID *ppUnregisterToken)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -787,7 +787,7 @@ RegisterForRuntimeStartupEx(
DLLEXPORT
HRESULT
UnregisterForRuntimeStartup(
__in PVOID pUnregisterToken)
_In_ PVOID pUnregisterToken)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -824,8 +824,8 @@ const int cchEventNameBufferSize = (sizeof(StartupNotifyEventNamePrefix) + sizeo
DLLEXPORT
HRESULT
GetStartupNotificationEvent(
__in DWORD debuggeePID,
__out HANDLE* phStartupEvent)
_In_ DWORD debuggeePID,
_Out_ HANDLE* phStartupEvent)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -1220,9 +1220,9 @@ DLLEXPORT
HRESULT
EnumerateCLRs(
DWORD debuggeePID,
__out HANDLE** ppHandleArrayOut,
__out LPWSTR** ppStringArrayOut,
__out DWORD* pdwArrayLengthOut)
_Out_ HANDLE** ppHandleArrayOut,
_Out_ LPWSTR** ppStringArrayOut,
_Out_ DWORD* pdwArrayLengthOut)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -1357,9 +1357,9 @@ EnumerateCLRs(
DLLEXPORT
HRESULT
CloseCLREnumeration(
__in HANDLE* pHandleArray,
__in LPWSTR* pStringArray,
__in DWORD dwArrayLength)
_In_ HANDLE* pHandleArray,
_In_ LPWSTR* pStringArray,
_In_ DWORD dwArrayLength)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -1484,11 +1484,11 @@ const WCHAR *c_versionStrFormat = W("%08x;%08x;%p");
DLLEXPORT
HRESULT
CreateVersionStringFromModule(
__in DWORD pidDebuggee,
__in LPCWSTR szModuleName,
_In_ DWORD pidDebuggee,
_In_ LPCWSTR szModuleName,
__out_ecount_part(cchBuffer, *pdwLength) LPWSTR pBuffer,
__in DWORD cchBuffer,
__out DWORD* pdwLength)
_In_ DWORD cchBuffer,
_Out_ DWORD* pdwLength)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -1719,9 +1719,9 @@ CheckDbiAndRuntimeVersion(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersionEx(
__in int iDebuggerVersion,
__in LPCWSTR szDebuggeeVersion,
__out IUnknown ** ppCordb)
_In_ int iDebuggerVersion,
_In_ LPCWSTR szDebuggeeVersion,
_Out_ IUnknown ** ppCordb)
{
return CreateDebuggingInterfaceFromVersion2(iDebuggerVersion, szDebuggeeVersion, NULL, ppCordb);
}
Expand All @@ -1748,10 +1748,10 @@ CreateDebuggingInterfaceFromVersionEx(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion2(
__in int iDebuggerVersion,
__in LPCWSTR szDebuggeeVersion,
__in LPCWSTR szApplicationGroupId,
__out IUnknown ** ppCordb)
_In_ int iDebuggerVersion,
_In_ LPCWSTR szDebuggeeVersion,
_In_ LPCWSTR szApplicationGroupId,
_Out_ IUnknown ** ppCordb)
{
PUBLIC_CONTRACT;

Expand Down Expand Up @@ -1880,8 +1880,8 @@ CreateDebuggingInterfaceFromVersion2(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion(
__in LPCWSTR szDebuggeeVersion,
__out IUnknown ** ppCordb
_In_ LPCWSTR szDebuggeeVersion,
_Out_ IUnknown ** ppCordb
)
{
PUBLIC_CONTRACT;
Expand All @@ -1907,7 +1907,7 @@ HRESULT
GetContinueStartupEvent(
DWORD debuggeePID,
LPCWSTR szTelestoFullPath,
__out HANDLE* phContinueStartupEvent)
_Out_ HANDLE* phContinueStartupEvent)
{
if ((phContinueStartupEvent == NULL) || (szTelestoFullPath == NULL))
return E_INVALIDARG;
Expand Down
Loading

0 comments on commit 9472bfe

Please sign in to comment.