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");
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
static BOOL RestoreIat(HMODULE TargetDll, PCSTR DllName, PCSTR FunctionName, ULONG_PTR OriginalFunction)
static BOOL RedirectIat(HMODULE TargetDll, PCSTR DllName, PCSTR FunctionName, ULONG_PTR NewFunction, ULONG_PTR *OriginalFunction)
DWORD get_host_winver(void)
void silence_debug_output(void)
#define RegCloseKey(hKey)
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NT_SUCCESS(StatCode)
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
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)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
#define MultiByteToWideChar
BOOL WINAPI DefineDosDeviceA(DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileA(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAA lpFindFileData)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
DWORD WINAPI GetLongPathNameA(IN LPCSTR lpszShortPath, OUT LPSTR lpszLongPath, IN DWORD cchBuffer)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
static const WCHAR fileW[]
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
@ ProcessWow64Information
static PCWSTR BOOL bMachine
static void test_Sign_Media(void)
static DWORD QueryFlag(void)
BOOL wrapAllowPermLayer(const char *str)
static void test_SdbGetPermLayerKeys(void)
void expect_Sdb_imp(PCSTR path, DWORD type, BOOL result, DWORD lenResult, PCSTR stringResult)
static PWSTR PDWORD pdwBytes
static void expect_LayerValue_imp(BOOL bMachine, const char *valueName, const char *value)
static BOOL wrapSdbSetPermLayerKeys2(LPCSTR dir, LPCSTR name, PCSTR szLayers, BOOL bMachine)
#define LAYER_APPLY_TO_SYSTEM_EXES
static void expect_LayerValue_imp2(BOOL bMachine, const char *valueName, const char *value, int use_alt, const char *alt_value)
static void test_SdbSetPermLayerKeysLevel(BOOL bMachine, const char *file)
static BOOL wrapSetPermLayerState(PCWSTR wszPath, PCSTR szLayer, DWORD dwFlags, BOOL bMachine, BOOL bEnable)
#define expect_LayerValue2
static PWSTR PDWORD DWORD dwFlags
static BOOL setLayerValue(BOOL bMachine, const char *valueName, const char *value)
#define expect_LayerValue
UINT WINAPI mGetDriveTypeW(LPCWSTR target)
static void test_AllowPermLayer(void)
static BOOL wrapSdbSetPermLayerKeys(PCWSTR wszPath, PCSTR szLayers, BOOL bMachine)
static PCWSTR DWORD BOOL BOOL bEnable
BOOL expect_files(const char *dir, int num,...)
static void test_SetPermLayerStateLevel(BOOL bMachine, const char *file)
static void test_SetPermLayer(void)
#define ERROR_FILE_NOT_FOUND
#define sprintf(buf, format,...)
static char workdir[MAX_PATH]
#define create_file(name, size)
static const char filler[0x1000]
#define cmp(status, error)
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)
#define NtCurrentProcess()
#define FILE_ATTRIBUTE_DIRECTORY
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
STRSAFEAPI StringCbPrintfA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat,...)
#define DDD_NO_BROADCAST_SYSTEM
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetLogicalDrives(void)
#define DDD_REMOVE_DEFINITION
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER