17#define DISPLAY_COLUMNS 78
18#define LINE_BUFFER_SIZE DISPLAY_COLUMNS + 2
25#define MEM_BLOCK_SIZE 0x80000
93 if (
' ' == szLine[spaceIndex])
99 memcpy(output + 2, szLine, spaceIndex + 1);
102 output[
strlen(output)] =
'\n';
109 sprintf(output,
"| %s\n", szLine);
242 OUTPUT_Banner(
"Testing the GlobalAlloc and GlobalFree calls");
350 OUTPUT_Line(
"Testing GlobalReAlloc() on memory allocated as GMEM_FIXED");
357 OUTPUT_Line(
"Testing to see if this is converted into a movable block");
361 OUTPUT_Line(
"GlobalReAlloc failed-- returned NULL");
370 OUTPUT_Line(
"GlobalReAlloc returned a fixed pointer.");
411 OUTPUT_Line(
"Testing to see if a new fixed block is returned.");
415 OUTPUT_Line(
"GlobalReAlloc failed-- returned NULL");
425 if (hMem == hReAlloced)
427 OUTPUT_Line(
"GlobalReAlloc returned the same pointer. The documentation states that this is wrong, but Windows NT works this way.");
454 OUTPUT_Line(
"Testing to see if a fixed pointer is reallocated in place.");
458 OUTPUT_Line(
"GlobalReAlloc failed-- returned NULL");
468 if (hMem != hReAlloced)
470 OUTPUT_Line(
"GlobalReAlloc returned a different.");
508 OUTPUT_Line(
"Testing GlobalReAlloc() on memory allocated as GMGM_MOVEABLE");
515 OUTPUT_Line(
"Testing GlobalReAlloc on a unlocked block.");
519 OUTPUT_Line(
"GlobalReAlloc failed-- returned NULL");
557 OUTPUT_Line(
"Testing GlobalReAlloc on a locked block.");
562 OUTPUT_Line(
"GlobalReAlloc failed-- returned NULL");
572 if (hMem != hReAlloced)
574 OUTPUT_Line(
"GlobalReAlloc returned a different block.");
684 OUTPUT_Line(
"Allocating an empty moveable block---automatically marked as discarded");
724 OUTPUT_Line(
"Testing for correct handling of GMEM_FIXED memory");
733 OUTPUT_Line(
"Testing for non-discarded and lock of 0");
736 (((
uFlags >> 8) & 0xff) == 0 ))
749 OUTPUT_Line(
"Testing for non-discarded and lock of 0");
752 (((
uFlags >> 8) & 0xff) == 0 ))
800 OUTPUT_Line(
"Testing GlobalHandle with a block of GMEM_FIXED memory");
834 OUTPUT_Line(
"Testing GlobalHandle with a block of GMEM_MOVEABLE memory");
884 OUTPUT_Line(
"Testing GlobalSize with a block of GMEM_FIXED memory");
912 OUTPUT_Line(
"Testing GlobalSize with a block of GMEM_MOVEABLE memory");
940 OUTPUT_Line(
"Testing GlobalSize with discarded memory");
1008 OUTPUT_Line(
"Block is not marked as discardable.");
1036 OUTPUT_Banner(
"Testing GlobalXXX memory management functions.");
1045 OUTPUT_Line(
"Skipping any further tests. GlobalAlloc/Free fails.");
ACPI_SIZE strlen(const char *String)
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLfloat GLfloat GLfloat GLfloat h
TEST_STATUS TEST_MemoryWrite(LPVOID mem, DWORD cbSize)
int IsMovable(HGLOBAL hMem)
void OUTPUT_HexDword(DWORD dw)
enum TestStatus TEST_STATUS
TEST_STATUS TEST_CombineStatus(TEST_STATUS a, TEST_STATUS b)
TEST_STATUS TEST_MemoryRead(LPVOID mem, DWORD cbSize)
void OUTPUT_Banner(const char *szBanner)
TEST_STATUS TestGlobalReAllocFixed()
TEST_STATUS TestGlobalDiscard()
TEST_STATUS TestGlobalFlagsFixed()
TEST_STATUS TestGlobalLockNUnlock(UINT allocFlags)
TEST_STATUS TestGlobalFlags()
void OutputAllocFlags(UINT pFlags)
TEST_STATUS TestGlobalAllocNFree(UINT allocFlags)
TEST_STATUS TestGlobalReAllocMovable()
TEST_STATUS TestGlobalFlagsMoveable()
TEST_STATUS TestGlobalHandle()
TEST_STATUS TestGlobalReAlloc()
TEST_STATUS TestGlobalSize()
void OUTPUT_Handle(HANDLE h)
void OUTPUT_Line(const char *szLine)
void OUTPUT_Result(TEST_STATUS status)
HGLOBAL NTAPI GlobalHandle(LPCVOID pMem)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
HGLOBAL NTAPI GlobalReAlloc(HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags)
UINT NTAPI GlobalFlags(HGLOBAL hMem)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
REFIID LPVOID DWORD_PTR dw
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
DWORD WINAPI GetLastError(void)