9 #define WIN32_NO_STATUS 27 #define GPLK_MACHINE 2 28 #define MAX_LAYER_LENGTH 256 29 #define LAYER_APPLY_TO_SYSTEM_EXES 1 81 char data[512] = { 0 };
90 winetest_ok(dwType ==
REG_SZ,
"Expected the type to be REG_SZ, was: %u\n", dwType);
120 if (!
result && lenResult == 0xffffffff)
121 winetest_ok(dwBufSize == 0 || dwBufSize ==
sizeof(
buffer),
"Expected dwBufSize to be 0 or %u, was %u\n",
sizeof(
buffer), dwBufSize);
126 "Expected dwBufSize to be %u, was %u\n", lenResult, dwBufSize);
133 winetest_ok(!
strcmp(stringResult, resultBuffer),
"Expected the result to be '%s', was '%s'\n", stringResult, resultBuffer);
142 dwBufSize =
sizeof(
buffer);
153 #define expect_Sdb (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_Sdb_imp 154 #define expect_LayerValue (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_LayerValue_imp 155 #define expect_LayerValue2 (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_LayerValue_imp2 162 return pAllowPermLayer(
buf);
175 ok(pAllowPermLayer(
NULL) ==
FALSE,
"Expected AllowPermLayer to fail for NULL\n");
185 for (drive_letter =
'a'; drive_letter <=
'z'; ++drive_letter)
203 WCHAR emptyString[1] = { 0 };
209 ok(pSdbSetPermLayerKeys(
NULL, emptyString,
bMachine) ==
FALSE,
"Expected SdbSetPermLayerKeys to fail\n");
210 ok(pSdbSetPermLayerKeys(emptyString, emptyString,
bMachine) ==
FALSE,
"Expected SdbSetPermLayerKeys to fail\n");
212 ok(pSdbSetPermLayerKeys(
fileW, emptyString,
bMachine) ==
TRUE,
"Expected SdbSetPermLayerKeys to fail\n");
254 ok(bUser,
"Expected to be able to set atleast the flags for the user\n");
257 skip(
"Cannot do any tests if I cannot set some values\n");
271 skip(
"Running these tests is useless without a file present\n");
279 ok(pSdbGetPermLayerKeys(
NULL,
NULL,
NULL, 0) ==
FALSE,
"Expected pSdbGetPermLayerKeys to fail\n");
280 ok(pSdbGetPermLayerKeys(pathW,
NULL,
NULL, 0) ==
FALSE,
"Expected pSdbGetPermLayerKeys to fail\n");
281 ok(pSdbGetPermLayerKeys(pathW,
buffer,
NULL, 0) ==
FALSE,
"Expected pSdbGetPermLayerKeys to fail\n");
282 ok(pSdbGetPermLayerKeys(pathW,
buffer, &dwBufSize, 0) ==
FALSE,
"Expected pSdbGetPermLayerKeys to fail\n");
283 ok(dwBufSize == 0,
"Expected dwBufSize to be %u, was %u\n", 0, dwBufSize);
311 skip(
"Skipping tests for HKLM, cannot alter the registry\n");
341 WCHAR emptyString[1] = { 0 };
542 skip(
"Running these tests is useless without a file present\n");
554 skip(
"Skipping SetPermLayerStateLevel tests for User, because I cannot prepare the environment\n");
563 skip(
"Skipping SetPermLayerStateLevel tests for Machine (HKLM), because I cannot prepare the environment\n");
654 return cmp == 0 &&
num == 0;
668 if (!(logical_drives &
idx))
676 skip(
"Unable to find a free drive\n");
698 ok(
ret,
"Expected redirect_iat to succeed\n");
715 skip(
"Skipping test, files are not returned in the expected order by the FS\n");
731 skip(
"Skipping test, files are not returned in the expected order by the FS\n");
747 skip(
"Skipping test, files are not returned in the expected order by the FS\n");
763 skip(
"Skipping test, files are not returned in the expected order by the FS\n");
777 if (!
expect_files(subdir, 3,
"test.bbb",
"test.exe",
"TEST.txt"))
779 skip(
"Skipping test, files are not returned in the expected order by the FS\n");
793 if (!
expect_files(subdir, 4,
"TEST.aaa",
"test.bbb",
"test.exe",
"TEST.txt"))
795 skip(
"Skipping test, files are not returned in the expected order by the FS\n");
807 ok(
ret,
"Expected restore_iat to succeed\n");
845 if (!pAllowPermLayer)
847 skip(
"Skipping tests with AllowPermLayer, function not found\n");
854 if (!pSdbSetPermLayerKeys)
856 skip(
"Skipping tests with SdbSetPermLayerKeys, function not found\n");
860 if (!pSdbGetPermLayerKeys)
862 skip(
"Skipping tests with SdbGetPermLayerKeys, function not found\n");
869 if (!pSetPermLayerState)
871 skip(
"Skipping tests with SetPermLayerState, function not found\n");
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
static const char filler[0x1000]
BOOL expect_files(const char *dir, int num,...)
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
#define WideCharToMultiByte
static void test_SetPermLayer(void)
static BOOL wrapSdbSetPermLayerKeys2(LPCSTR dir, LPCSTR name, PCSTR szLayers, BOOL bMachine)
ACPI_SIZE strlen(const char *String)
#define expect_LayerValue2
GLsizei const GLchar ** path
#define DDD_REMOVE_DEFINITION
#define HKEY_CURRENT_USER
BOOL WINAPI PathAppendA(LPSTR lpszPath, LPCSTR lpszAppend)
static BOOL(WINAPI *pAllowPermLayer)(PCWSTR path)
#define DDD_NO_BROADCAST_SYSTEM
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
#define cmp(status, error)
BOOL WINAPI FindNextFileA(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAA lpFindFileData)
#define expect_LayerValue
static void expect_LayerValue_imp(BOOL bMachine, const char *valueName, const char *value)
DWORD WINAPI GetLongPathNameA(IN LPCSTR lpszShortPath, OUT LPSTR lpszLongPath, IN DWORD cchBuffer)
DWORD get_host_winver(void)
#define sprintf(buf, format,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
static void test_AllowPermLayer(void)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
#define ERROR_FILE_NOT_FOUND
static DWORD g_WinVersion
static BOOL RestoreIat(HMODULE TargetDll, PCSTR DllName, PCSTR FunctionName, ULONG_PTR OriginalFunction)
static BOOL create_file(LPCSTR dir, LPCSTR name, int filler, DWORD size)
#define NtCurrentProcess()
#define FILE_ATTRIBUTE_DIRECTORY
static void test_Sign_Media(void)
static BOOL wrapSdbSetPermLayerKeys(PCWSTR wszPath, PCSTR szLayers, BOOL bMachine)
STRSAFEAPI StringCbPrintfA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat,...)
#define NT_SUCCESS(StatCode)
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
static char workdir[MAX_PATH]
static void expect_LayerValue_imp2(BOOL bMachine, const char *valueName, const char *value, int use_alt, const char *alt_value)
static PCWSTR DWORD BOOL BOOL bEnable
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
static PWSTR PDWORD DWORD dwFlags
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
LPSTR WINAPI PathCombineA(LPSTR lpszDest, LPCSTR lpszDir, LPCSTR lpszFile)
static PWSTR PDWORD pdwBytes
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
UINT(WINAPI *pGetDriveTypeW)(LPCWSTR target)
BOOL wrapAllowPermLayer(const char *str)
#define FILE_ATTRIBUTE_NORMAL
void silence_debug_output(void)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
static void test_SdbGetPermLayerKeys(void)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
static void test_SetPermLayerStateLevel(BOOL bMachine, const char *file)
void expect_Sdb_imp(PCSTR path, DWORD type, BOOL result, DWORD lenResult, PCSTR stringResult)
DWORD WINAPI GetLogicalDrives(VOID)
static BOOL RedirectIat(HMODULE TargetDll, PCSTR DllName, PCSTR FunctionName, ULONG_PTR NewFunction, ULONG_PTR *OriginalFunction)
static BOOL wrapSetPermLayerState(PCWSTR wszPath, PCSTR szLayer, DWORD dwFlags, BOOL bMachine, BOOL bEnable)
static void test_SdbSetPermLayerKeysLevel(BOOL bMachine, const char *file)
BOOL WINAPI DefineDosDeviceA(DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
static BOOL delete_file(LPCSTR dir, LPCSTR name)
#define MultiByteToWideChar
UINT WINAPI mGetDriveTypeW(LPCWSTR target)
static DWORD QueryFlag(void)
int strcmp(const char *String1, const char *String2)
#define GetProcAddress(x, y)
GLuint GLuint GLsizei GLenum type
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
#define LAYER_APPLY_TO_SYSTEM_EXES
#define CreateFileA(a, b, c, d, e, f, g)
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
static const WCHAR fileW[]
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
static PCWSTR BOOL bMachine
#define RegCloseKey(hKey)
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
#define HKEY_LOCAL_MACHINE
static BOOL setLayerValue(BOOL bMachine, const char *valueName, const char *value)
BOOL WINAPI FindClose(HANDLE hFindFile)