kernel32/tests: Get the test to run on Windows 95.

This commit is contained in:
Francois Gouget 2007-12-10 01:24:49 +01:00 committed by Alexandre Julliard
parent c43f61461f
commit 8ee430d146
2 changed files with 17 additions and 2 deletions

View File

@ -29,6 +29,7 @@ static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR); static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
static BOOL (WINAPI *pFindActCtxSectionStringW)(DWORD,const GUID *,ULONG,LPCWSTR,PACTCTX_SECTION_KEYED_DATA); static BOOL (WINAPI *pFindActCtxSectionStringW)(DWORD,const GUID *,ULONG,LPCWSTR,PACTCTX_SECTION_KEYED_DATA);
static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *); static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *);
static BOOL (WINAPI *pIsDebuggerPresent)(void);
static BOOL (WINAPI *pQueryActCtxW)(DWORD,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*); static BOOL (WINAPI *pQueryActCtxW)(DWORD,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*);
static VOID (WINAPI *pReleaseActCtx)(HANDLE); static VOID (WINAPI *pReleaseActCtx)(HANDLE);
@ -881,8 +882,9 @@ static void test_actctx(void)
test_detailed_info(handle, &detailed_info1); test_detailed_info(handle, &detailed_info1);
test_info_in_assembly(handle, 1, &manifest1_info); test_info_in_assembly(handle, 1, &manifest1_info);
if (!IsDebuggerPresent()) /* CloseHandle will generate an exception if a debugger is present */ if (pIsDebuggerPresent && !pIsDebuggerPresent())
{ {
/* CloseHandle will generate an exception if a debugger is present */
b = CloseHandle(handle); b = CloseHandle(handle);
ok(!b, "CloseHandle succeeded\n"); ok(!b, "CloseHandle succeeded\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %u\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %u\n", GetLastError());
@ -1137,6 +1139,7 @@ static BOOL init_funcs(void)
X(DeactivateActCtx); X(DeactivateActCtx);
X(FindActCtxSectionStringW); X(FindActCtxSectionStringW);
X(GetCurrentActCtx); X(GetCurrentActCtx);
X(IsDebuggerPresent);
X(QueryActCtxW); X(QueryActCtxW);
X(ReleaseActCtx); X(ReleaseActCtx);
#undef X #undef X

View File

@ -28,6 +28,9 @@
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
static HINSTANCE hkernel32;
static HANDLE (WINAPI *pFindFirstFileExA)(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
/* keep filename and filenameW the same */ /* keep filename and filenameW the same */
static const char filename[] = "testfile.xxx"; static const char filename[] = "testfile.xxx";
static const WCHAR filenameW[] = { 't','e','s','t','f','i','l','e','.','x','x','x',0 }; static const WCHAR filenameW[] = { 't','e','s','t','f','i','l','e','.','x','x','x',0 };
@ -1420,12 +1423,18 @@ static void test_FindFirstFileExA(void)
WIN32_FIND_DATAA search_results; WIN32_FIND_DATAA search_results;
HANDLE handle; HANDLE handle;
if (!pFindFirstFileExA)
{
skip("FindFirstFileExA() is missing\n");
return;
}
CreateDirectoryA("test-dir", NULL); CreateDirectoryA("test-dir", NULL);
_lclose(_lcreat("test-dir\\file1", 0)); _lclose(_lcreat("test-dir\\file1", 0));
_lclose(_lcreat("test-dir\\file2", 0)); _lclose(_lcreat("test-dir\\file2", 0));
CreateDirectoryA("test-dir\\dir1", NULL); CreateDirectoryA("test-dir\\dir1", NULL);
/* FindExLimitToDirectories is ignored */ /* FindExLimitToDirectories is ignored */
handle = FindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, FindExSearchLimitToDirectories, NULL, 0); handle = pFindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, FindExSearchLimitToDirectories, NULL, 0);
ok(handle != INVALID_HANDLE_VALUE, "FindFirstFile failed (err=%u)\n", GetLastError()); ok(handle != INVALID_HANDLE_VALUE, "FindFirstFile failed (err=%u)\n", GetLastError());
ok(strcmp(search_results.cFileName, ".") == 0, "First entry should be '.', is %s\n", search_results.cFileName); ok(strcmp(search_results.cFileName, ".") == 0, "First entry should be '.', is %s\n", search_results.cFileName);
@ -1895,6 +1904,9 @@ static void test_RemoveDirectory(void)
START_TEST(file) START_TEST(file)
{ {
hkernel32 = GetModuleHandleA("kernel32.dll");
pFindFirstFileExA=(void*)GetProcAddress(hkernel32, "FindFirstFileExA");
test__hread( ); test__hread( );
test__hwrite( ); test__hwrite( );
test__lclose( ); test__lclose( );