windows.cfg: Add some commonly used macros (#1127)
This commit is contained in:
parent
25ef18ab11
commit
e38ec41ded
|
@ -5137,4 +5137,16 @@ HFONT CreateFont(
|
||||||
<define name="FillMemory" value="RtlFillMemory"/>
|
<define name="FillMemory" value="RtlFillMemory"/>
|
||||||
<define name="ZeroMemory" value="RtlZeroMemory"/>
|
<define name="ZeroMemory" value="RtlZeroMemory"/>
|
||||||
<define name="SecureZeroMemory" value="RtlSecureZeroMemory"/>
|
<define name="SecureZeroMemory" value="RtlSecureZeroMemory"/>
|
||||||
|
<!-- WORD MAKEWORD(BYTE bLow, BYTE bHigh); -->
|
||||||
|
<define name="MAKEWORD(bLow, bHigh)" value="((WORD)(((BYTE)(((DWORD_PTR)(bLow)) & 0xff)) | ((WORD)((BYTE)(((DWORD_PTR)(bHigh)) & 0xff))) << 8))"/>
|
||||||
|
<!-- DWORD MAKELONG(WORD wLow, WORD wHigh); -->
|
||||||
|
<define name="MAKELONG(wLow, wHigh)" value="((LONG)(((WORD)(((DWORD_PTR)(wLow)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(wHigh)) & 0xffff))) << 16))"/>
|
||||||
|
<!-- WORD LOWORD(DWORD dwValue); -->
|
||||||
|
<define name="LOWORD(dwValue)" value="((WORD)(((DWORD_PTR)(dwValue)) & 0xffff))"/>
|
||||||
|
<!-- WORD HIWORD(DWORD dwValue); -->
|
||||||
|
<define name="HIWORD(dwValue)" value="((WORD)((((DWORD_PTR)(dwValue)) >> 16) & 0xffff))"/>
|
||||||
|
<!-- BYTE LOBYTE(WORD wValue); -->
|
||||||
|
<define name="LOBYTE(wValue)" value="((BYTE)(((DWORD_PTR)(wValue)) & 0xff))"/>
|
||||||
|
<!-- BYTE HIBYTE(WORD wValue); -->
|
||||||
|
<define name="HIBYTE(wValue)" value="((BYTE)((((DWORD_PTR)(wValue)) >> 8) & 0xff))"/>
|
||||||
</def>
|
</def>
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
void validCode()
|
void validCode()
|
||||||
{
|
{
|
||||||
|
DWORD dwordInit = 0;
|
||||||
|
WORD wordInit = 0;
|
||||||
|
BYTE byteInit = 0;
|
||||||
|
|
||||||
// Valid Semaphore usage, no leaks, valid arguments
|
// Valid Semaphore usage, no leaks, valid arguments
|
||||||
HANDLE hSemaphore1;
|
HANDLE hSemaphore1;
|
||||||
hSemaphore1 = CreateSemaphore(NULL, 0, 1, NULL);
|
hSemaphore1 = CreateSemaphore(NULL, 0, 1, NULL);
|
||||||
|
@ -116,7 +120,6 @@ void validCode()
|
||||||
_stprintf(bufTC, _countof(bufTC), TEXT("%d"), 2);
|
_stprintf(bufTC, _countof(bufTC), TEXT("%d"), 2);
|
||||||
_tprintf(TEXT("%s"), bufTC);
|
_tprintf(TEXT("%s"), bufTC);
|
||||||
|
|
||||||
DWORD dwordInit = 0;
|
|
||||||
GetUserName(NULL, &dwordInit);
|
GetUserName(NULL, &dwordInit);
|
||||||
dwordInit = 10;
|
dwordInit = 10;
|
||||||
GetUserName(bufTC, _countof(bufTC));
|
GetUserName(bufTC, _countof(bufTC));
|
||||||
|
@ -131,6 +134,16 @@ void validCode()
|
||||||
}
|
}
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
|
|
||||||
|
wordInit = MAKEWORD(1, 2);
|
||||||
|
dwordInit = MAKELONG(1, 2);
|
||||||
|
// cppcheck-suppress redundantAssignment
|
||||||
|
wordInit = LOWORD(dwordInit);
|
||||||
|
byteInit = LOBYTE(wordInit);
|
||||||
|
wordInit = HIWORD(dwordInit);
|
||||||
|
// cppcheck-suppress redundantAssignment
|
||||||
|
byteInit = HIBYTE(wordInit);
|
||||||
|
if (byteInit) {}
|
||||||
|
|
||||||
bool boolVar;
|
bool boolVar;
|
||||||
uint8_t byteBuf[5] = {0};
|
uint8_t byteBuf[5] = {0};
|
||||||
uint8_t byteBuf2[10] = {0};
|
uint8_t byteBuf2[10] = {0};
|
||||||
|
|
Loading…
Reference in New Issue