25#define WIN32_NO_STATUS
31#include "wine/winternl.h"
34#define PSAPI_VERSION 1
41static BOOL (
WINAPI *pWow64DisableWow64FsRedirection)(
void **);
42static BOOL (
WINAPI *pWow64RevertWow64FsRedirection)(
void *);
66 ok(cbUsed == 0,
"cbUsed=%d\n", cbUsed);
71 ok(cbUsed == 4,
"cbUsed=%d\n", cbUsed);
76 char buffer[200] =
"C:\\windows\\system32\\notepad.exe";
92 hMod = (
void *)0xdeadbeef;
94 ok(!
ret,
"succeeded\n");
98 hMod = (
void *)0xdeadbeef;
100 ok(!
ret,
"succeeded\n");
111 ok(!
ret,
"succeeded\n");
115 hMod = (
void *)0xdeadbeef;
120 ok(cbNeeded %
sizeof(hMod) == 0,
"not a multiple of sizeof(HMODULE) cbNeeded=%d\n", cbNeeded);
126 ok(!
ret,
"wait timed out\n");
132 ok(!!hMod,
"expected non-NULL module\n");
133 ok(cbNeeded %
sizeof(hMod) == 0,
"got %u\n", cbNeeded);
137 if (
sizeof(
void *) == 8)
147 ok(!
ret,
"wait timed out\n");
153 ok(!!hMod,
"expected non-NULL module\n");
154 ok(cbNeeded %
sizeof(hMod) == 0,
"got %u\n", cbNeeded);
167 ok(
info.lpBaseOfDll == hMod,
"expected %p, got %p\n", hMod,
info.lpBaseOfDll);
168 ok(
info.SizeOfImage,
"image size was 0\n");
169 ok(
info.EntryPoint >=
info.lpBaseOfDll,
"got entry point %p\n",
info.EntryPoint);
175 pWow64DisableWow64FsRedirection(&
cookie);
177 pWow64RevertWow64FsRedirection(
cookie);
181 ok(!
ret,
"wait timed out\n");
218 ok(
info.lpBaseOfDll == hMod,
"lpBaseOfDll=%p hMod=%p\n",
info.lpBaseOfDll, hMod);
226 for (tmp = (
DWORD *)hMod;
info.SizeOfImage;
info.SizeOfImage--)
235 return (perf >=
max(sysperf, margin) - margin && perf <= sysperf + margin);
247 ok(!
ret,
"GetPerformanceInfo unexpectedly succeeded\n");
250 if (!pNtQuerySystemInformation)
251 win_skip(
"NtQuerySystemInformation not found, skipping tests\n");
272 "expected approximately %ld but got %d\n",
info.CommitTotal, sys_performance_info->TotalCommittedPages);
275 "expected approximately %ld but got %d\n",
info.CommitLimit, sys_performance_info->TotalCommitLimit);
278 "expected approximately %ld but got %d\n",
info.CommitPeak, sys_performance_info->PeakCommitment);
281 "expected approximately %ld but got %d\n",
info.PhysicalAvailable, sys_performance_info->AvailablePages);
285 ok(
check_with_margin(
info.KernelTotal, sys_performance_info->PagedPoolUsage + sys_performance_info->NonPagedPoolUsage, 256),
286 "expected approximately %ld but got %d\n",
info.KernelTotal,
287 sys_performance_info->PagedPoolUsage + sys_performance_info->NonPagedPoolUsage);
290 "expected approximately %ld but got %d\n",
info.KernelPaged, sys_performance_info->PagedPoolUsage);
293 "expected approximately %ld but got %d\n",
info.KernelNonpaged, sys_performance_info->NonPagedPoolUsage);
301 ok(
info.PhysicalTotal == sys_basic_info.MmNumberOfPhysicalPages,
302 "expected info.PhysicalTotal=%u but got %u\n",
303 sys_basic_info.MmNumberOfPhysicalPages, (
ULONG)
info.PhysicalTotal);
306 "expected info.PageSize=%u but got %u\n",
317 ok(sys_process_info !=
NULL,
"failed to allocate memory\n");
328 handle_count += spi->HandleCount;
330 if (spi->NextEntryOffset == 0)
break;
335 "expected approximately %d but got %d\n",
info.HandleCount, handle_count);
338 "expected approximately %d but got %d\n",
info.ProcessCount, process_count);
353 ok(!
ret,
"GetProcessMemoryInfo should fail\n");
358 ok(!
ret,
"GetProcessMemoryInfo should fail\n");
363 ok(!
ret,
"GetProcessMemoryInfo should fail\n");
378 if (!pNtQueryVirtualMemory)
return FALSE;
390 ok((
char *)section_name->
SectionFileName.
Buffer == (
char *)section_name +
sizeof(*section_name),
"got %p, %p\n",
418 ok(!
ret,
"GetMappedFileName should fail\n");
423 ok(!
ret,
"GetMappedFileName should fail\n");
429 "GetMappedFileNameA failed with error %u\n",
GetLastError() );
432 ok(
ret ==
strlen(szMapPath),
"szMapPath=\"%s\" ret=%d\n", szMapPath,
ret);
433 ok(szMapPath[0] ==
'\\',
"szMapPath=\"%s\"\n", szMapPath);
434 szMapBaseName =
strrchr(szMapPath,
'\\');
435 ok(szMapBaseName && *szMapBaseName,
"szMapPath=\"%s\"\n", szMapPath);
440 "szModPath=\"%s\" szMapBaseName=\"%s\"\n", szModPath, szMapBaseName);
471 ok(!
ret,
"GetMappedFileName should fail\n");
477 ok(!
ret,
"GetMappedFileName should fail\n");
483 ok(!map_name[0] ||
broken(map_name[0] ==
device_name[0]) ,
"expected 0, got %c\n", map_name[0]);
499 ok(
memcmp(map_nameW, nt_map_name,
lstrlenW(map_nameW)) == 0,
"map name does not start with a device name: %s\n", map_name);
511 ok(
memcmp(map_nameW, nt_map_name,
lstrlenW(map_nameW)) == 0,
"map name does not start with a device name: %s\n", map_name);
524 ok(!
ret,
"GetMappedFileName should fail\n");
529 ok(!
ret,
"GetMappedFileName should fail\n");
535 ok(!
ret,
"GetMappedFileName should fail\n");
553 ok(!
ret,
"GetMappedFileName should fail\n");
573 win_skip(
"GetProcessImageFileName not implemented\n");
600 ok(
ret >=
strlen(szImgPath),
"szImgPath=\"%s\" ret=%d\n", szImgPath,
ret);
601 ok(!
strcmp(szImgPath, szMapPath),
"szImgPath=\"%s\" szMapPath=\"%s\"\n", szImgPath, szMapPath);
618 memset(szImgPathW, 0xff,
sizeof(szImgPathW));
620 ok(
ret > 0,
"GetProcessImageFileNameW should have succeeded.\n");
621 ok(szImgPathW[0] ==
'\\',
"GetProcessImageFileNameW should have returned an NT path.\n");
629 memset(szImgPathW, 0xff,
sizeof(szImgPathW));
631 ok(
ret > 0,
"GetProcessImageFileNameW should have succeeded.\n");
632 ok(szImgPathW[0] ==
'\\',
"GetProcessImageFileNameW should have returned an NT path.\n");
645 ok( !
ret,
"GetModuleFileNameExA succeeded\n" );
650 ok( !
ret,
"GetModuleFileNameExA succeeded\n" );
655 ok( !
ret,
"GetModuleFileNameExA succeeded\n" );
661 ok(
ret ==
strlen(szModExPath),
"szModExPath=\"%s\" ret=%d\n", szModExPath,
ret);
664 "szModExPath=\"%s\" szModPath=\"%s\"\n", szModExPath, szModPath);
667 memset( szModExPath, 0xcc,
sizeof(szModExPath) );
671 "szModExPath=\"%s\" ret=%d\n", szModExPath,
ret );
678 ok(
ret == 0,
"wrong length %u\n",
ret );
695 ok(
ret == 0,
"wrong length %u\n",
ret );
722 ok(
ret ==
strlen(szModBaseName),
"szModBaseName=\"%s\" ret=%d\n", szModBaseName,
ret);
725 "szModPath=\"%s\" szModBaseName=\"%s\"\n", szModPath, szModBaseName);
760 trace(
"InitializeProcessForWsWatch not supported\n" );
785 for(
i = 0;
i < pages[0];
i++)
792 todo_wine ok(0,
"QueryWorkingSet didn't find our page\n");
808 todo_wine ok(0,
"GetWsChanges didn't find our page\n");
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
#define ERROR_INSUFFICIENT_BUFFER
#define ERROR_INVALID_FUNCTION
#define ERROR_INVALID_PARAMETER
#define GetModuleFileNameExW(w, x, y, z)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define GetCurrentProcess()
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
#define WideCharToMultiByte
#define ERROR_ACCESS_DENIED
DWORD WINAPI QueryDosDeviceA(LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
DWORD WINAPI GetModuleFileNameExA(HANDLE hProcess, HMODULE hModule, LPSTR lpFilename, DWORD nSize)
DWORD WINAPI GetMappedFileNameW(HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename, DWORD nSize)
BOOL WINAPI QueryWorkingSet(HANDLE hProcess, PVOID pv, DWORD cb)
BOOL WINAPI GetProcessMemoryInfo(HANDLE Process, PPROCESS_MEMORY_COUNTERS ppsmemCounters, DWORD cb)
BOOL WINAPI EmptyWorkingSet(HANDLE hProcess)
BOOL WINAPI GetWsChanges(HANDLE hProcess, PPSAPI_WS_WATCH_INFORMATION lpWatchInfo, DWORD cb)
DWORD WINAPI GetModuleBaseNameA(HANDLE hProcess, HMODULE hModule, LPSTR lpBaseName, DWORD nSize)
BOOL WINAPI EnumProcessModules(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded)
BOOL WINAPI InitializeProcessForWsWatch(HANDLE hProcess)
BOOL WINAPI GetPerformanceInfo(PPERFORMANCE_INFORMATION pPerformanceInformation, DWORD cb)
DWORD WINAPI GetProcessImageFileNameW(HANDLE hProcess, LPWSTR lpImageFileName, DWORD nSize)
DWORD WINAPI GetProcessImageFileNameA(HANDLE hProcess, LPSTR lpImageFileName, DWORD nSize)
DWORD WINAPI GetMappedFileNameA(HANDLE hProcess, LPVOID lpv, LPSTR lpFilename, DWORD nSize)
BOOL WINAPI EnumProcesses(DWORD *lpidProcess, DWORD cb, LPDWORD lpcbNeeded)
BOOL WINAPI GetModuleInformation(HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb)
static const WCHAR device_name[]
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
@ SystemProcessInformation
enum _SYSTEM_INFORMATION_CLASS SYSTEM_INFORMATION_CLASS
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define PROCESS_QUERY_INFORMATION
#define PROCESS_SET_INFORMATION
#define PROCESS_SET_QUOTA
#define SystemPerformanceInformation
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
#define memcpy(s1, s2, n)
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
#define STANDARD_RIGHTS_REQUIRED
static uint32_t thread_count(IN pnfs_layout_state *state, IN enum pnfs_iomode iomode, IN uint64_t offset, IN uint64_t length)
static BOOL init_func_ptrs(void)
static BOOL check_with_margin(SIZE_T perf, SIZE_T sysperf, int margin)
static void test_ws_functions(void)
static void test_EnumProcesses(void)
static void test_GetMappedFileName(void)
static BOOL nt_get_mapped_file_name(HANDLE process, LPVOID addr, LPWSTR name, DWORD len)
static void test_GetPerformanceInfo(void)
static void test_GetModuleInformation(void)
static void test_GetModuleBaseName(void)
static void test_GetModuleFileNameEx(void)
static void test_GetProcessMemoryInfo(void)
static void test_GetProcessImageFileName(void)
static void test_EnumProcessModules(void)
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
UNICODE_STRING SectionFileName
#define STATUS_INFO_LENGTH_MISMATCH
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
BOOL NTAPI VirtualLock(IN LPVOID lpAddress, IN SIZE_T dwSize)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentProcessId(void)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
#define ERROR_PARTIAL_COPY
#define ERROR_FILE_INVALID
#define ERROR_UNEXP_NET_ERR
DWORD WINAPI WaitForInputIdle(_In_ HANDLE, _In_ DWORD)
#define DUPLICATE_SAME_ACCESS