mirror of
https://github.com/reactos/reactos.git
synced 2025-04-18 19:47:14 +00:00
sync kernel32_winetest with wine 1.1.24
svn path=/trunk/; revision=41580
This commit is contained in:
parent
c90eb62d17
commit
2d5297edef
4 changed files with 175 additions and 90 deletions
|
@ -561,6 +561,7 @@ static void test_BuildCommDCBW(TEST *ptest, int initial_value, DCB *pexpected_dc
|
|||
BOOL result;
|
||||
DCB dcb;
|
||||
WCHAR wide_string[sizeof(ptest->string)];
|
||||
static int reportedDCBW = 0;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR));
|
||||
|
||||
|
@ -572,7 +573,8 @@ static void test_BuildCommDCBW(TEST *ptest, int initial_value, DCB *pexpected_dc
|
|||
|
||||
if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
win_skip("BuildCommDCBW is not available\n");
|
||||
if(!reportedDCBW++)
|
||||
win_skip("BuildCommDCBW is not implemented\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -587,6 +589,7 @@ static void test_BuildCommDCBAndTimeoutsW(TEST *ptest, int initial_value, DCB *p
|
|||
DCB dcb;
|
||||
COMMTIMEOUTS timeouts;
|
||||
WCHAR wide_string[sizeof(ptest->string)];
|
||||
static int reportedDCBAndTW = 0;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR));
|
||||
|
||||
|
@ -599,14 +602,15 @@ static void test_BuildCommDCBAndTimeoutsW(TEST *ptest, int initial_value, DCB *p
|
|||
|
||||
if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
win_skip("BuildCommDCBAndTimeoutsW is not available\n");
|
||||
if(!reportedDCBAndTW++)
|
||||
win_skip("BuildCommDCBAndTimeoutsW is not implemented\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* check results */
|
||||
check_result("BuildCommDCBAndTimeoutsA", ptest, initial_value, result);
|
||||
check_dcb("BuildCommDCBAndTimeoutsA", ptest, initial_value, &dcb, pexpected_dcb);
|
||||
check_timeouts("BuildCommDCBAndTimeoutsA", ptest, initial_value, &timeouts, pexpected_timeouts);
|
||||
check_result("BuildCommDCBAndTimeoutsW", ptest, initial_value, result);
|
||||
check_dcb("BuildCommDCBAndTimeoutsW", ptest, initial_value, &dcb, pexpected_dcb);
|
||||
check_timeouts("BuildCommDCBAndTimeoutsW", ptest, initial_value, &timeouts, pexpected_timeouts);
|
||||
}
|
||||
|
||||
static void test_BuildCommDCB(void)
|
||||
|
|
|
@ -55,10 +55,11 @@ static const char sillytext[] =
|
|||
"sdlkfjasdlkfj a dslkj adsklf \n \nasdklf askldfa sdlkf \nsadklf asdklf asdf ";
|
||||
|
||||
struct test_list {
|
||||
const char *file;
|
||||
const DWORD err;
|
||||
const DWORD options;
|
||||
const BOOL todo_flag;
|
||||
const char *file; /* file string to test */
|
||||
const DWORD err; /* Win NT and further error code */
|
||||
const LONG err2; /* Win 9x & ME error code or -1 */
|
||||
const DWORD options; /* option flag to use for open */
|
||||
const BOOL todo_flag; /* todo_wine indicator */
|
||||
} ;
|
||||
|
||||
static void InitFunctionPointers(void)
|
||||
|
@ -717,19 +718,19 @@ static void test_CreateFileA(void)
|
|||
static const char nt_drive[] = "\\\\?\\A:";
|
||||
DWORD i, ret, len;
|
||||
struct test_list p[] = {
|
||||
{"", ERROR_PATH_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, TRUE }, /* dir as file w \ */
|
||||
{"", ERROR_SUCCESS, FILE_FLAG_BACKUP_SEMANTICS, FALSE }, /* dir as dir w \ */
|
||||
{"a", ERROR_FILE_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, FALSE }, /* non-exist file */
|
||||
{"a\\", ERROR_FILE_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, FALSE }, /* non-exist dir */
|
||||
{"removeme", ERROR_ACCESS_DENIED, FILE_ATTRIBUTE_NORMAL, FALSE }, /* exist dir w/o \ */
|
||||
{"removeme\\", ERROR_PATH_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, TRUE }, /* exst dir w \ */
|
||||
{"c:", ERROR_ACCESS_DENIED, FILE_ATTRIBUTE_NORMAL, FALSE }, /* device in file namespace */
|
||||
{"c:", ERROR_SUCCESS, FILE_FLAG_BACKUP_SEMANTICS, FALSE }, /* device in file namespace as dir */
|
||||
{"c:\\", ERROR_PATH_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, TRUE }, /* root dir w \ */
|
||||
{"c:\\", ERROR_SUCCESS, FILE_FLAG_BACKUP_SEMANTICS, FALSE }, /* root dir w \ as dir */
|
||||
{"\\\\?\\c:", ERROR_SUCCESS, FILE_ATTRIBUTE_NORMAL,FALSE }, /* dev namespace drive */
|
||||
{"\\\\?\\c:\\", ERROR_PATH_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, TRUE }, /* dev namespace drive w \ */
|
||||
{NULL, 0, 0, FALSE}
|
||||
{"", ERROR_PATH_NOT_FOUND, -1, FILE_ATTRIBUTE_NORMAL, TRUE }, /* dir as file w \ */
|
||||
{"", ERROR_SUCCESS, ERROR_PATH_NOT_FOUND, FILE_FLAG_BACKUP_SEMANTICS, FALSE }, /* dir as dir w \ */
|
||||
{"a", ERROR_FILE_NOT_FOUND, -1, FILE_ATTRIBUTE_NORMAL, FALSE }, /* non-exist file */
|
||||
{"a\\", ERROR_FILE_NOT_FOUND, ERROR_PATH_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, FALSE }, /* non-exist dir */
|
||||
{"removeme", ERROR_ACCESS_DENIED, -1, FILE_ATTRIBUTE_NORMAL, FALSE }, /* exist dir w/o \ */
|
||||
{"removeme\\", ERROR_PATH_NOT_FOUND, -1, FILE_ATTRIBUTE_NORMAL, TRUE }, /* exst dir w \ */
|
||||
{"c:", ERROR_ACCESS_DENIED, ERROR_PATH_NOT_FOUND, FILE_ATTRIBUTE_NORMAL, FALSE }, /* device in file namespace */
|
||||
{"c:", ERROR_SUCCESS, ERROR_PATH_NOT_FOUND, FILE_FLAG_BACKUP_SEMANTICS, FALSE }, /* device in file namespace as dir */
|
||||
{"c:\\", ERROR_PATH_NOT_FOUND, ERROR_ACCESS_DENIED, FILE_ATTRIBUTE_NORMAL, TRUE }, /* root dir w \ */
|
||||
{"c:\\", ERROR_SUCCESS, ERROR_ACCESS_DENIED, FILE_FLAG_BACKUP_SEMANTICS, FALSE }, /* root dir w \ as dir */
|
||||
{"\\\\?\\c:", ERROR_SUCCESS, ERROR_BAD_NETPATH, FILE_ATTRIBUTE_NORMAL,FALSE }, /* dev namespace drive */
|
||||
{"\\\\?\\c:\\", ERROR_PATH_NOT_FOUND, ERROR_BAD_NETPATH, FILE_ATTRIBUTE_NORMAL, TRUE }, /* dev namespace drive w \ */
|
||||
{NULL, 0, -1, 0, FALSE}
|
||||
};
|
||||
BY_HANDLE_FILE_INFORMATION Finfo;
|
||||
|
||||
|
@ -829,13 +830,17 @@ static void test_CreateFileA(void)
|
|||
}
|
||||
/* otherwise validate results with expectations */
|
||||
else if (p[i].todo_flag)
|
||||
todo_wine ok((hFile == INVALID_HANDLE_VALUE && p[i].err == GetLastError()) ||
|
||||
todo_wine ok(
|
||||
(hFile == INVALID_HANDLE_VALUE &&
|
||||
(p[i].err == GetLastError() || p[i].err2 == GetLastError())) ||
|
||||
(hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
|
||||
"CreateFileA failed on %s, hFile %p, err=%u, should be %u\n",
|
||||
filename, hFile, GetLastError(), p[i].err);
|
||||
else
|
||||
ok((hFile == INVALID_HANDLE_VALUE && p[i].err == GetLastError()) ||
|
||||
(hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
|
||||
ok(
|
||||
(hFile == INVALID_HANDLE_VALUE &&
|
||||
(p[i].err == GetLastError() || p[i].err2 == GetLastError())) ||
|
||||
(hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
|
||||
"CreateFileA failed on %s, hFile %p, err=%u, should be %u\n",
|
||||
filename, hFile, GetLastError(), p[i].err);
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
|
@ -852,21 +857,26 @@ static void test_CreateFileA(void)
|
|||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL );
|
||||
ok(hFile != INVALID_HANDLE_VALUE && GetLastError() == ERROR_SUCCESS,
|
||||
if (hFile != INVALID_HANDLE_VALUE && GetLastError() != ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
ok(hFile != INVALID_HANDLE_VALUE && GetLastError() == ERROR_SUCCESS,
|
||||
"CreateFileA did not work, last error %u on volume <%s>\n",
|
||||
GetLastError(), temp_path );
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ret = GetFileInformationByHandle( hFile, &Finfo );
|
||||
if (ret)
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ok(Finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY,
|
||||
"CreateFileA probably did not open temp directory %s correctly\n file information does not include FILE_ATTRIBUTE_DIRECTORY, actual=0x%08x\n",
|
||||
ret = GetFileInformationByHandle( hFile, &Finfo );
|
||||
if (ret)
|
||||
{
|
||||
ok(Finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY,
|
||||
"CreateFileA probably did not open temp directory %s correctly\n file information does not include FILE_ATTRIBUTE_DIRECTORY, actual=0x%08x\n",
|
||||
temp_path, Finfo.dwFileAttributes);
|
||||
}
|
||||
CloseHandle( hFile );
|
||||
}
|
||||
CloseHandle( hFile );
|
||||
}
|
||||
else
|
||||
skip("Probable Win9x, got ERROR_PATH_NOT_FOUND w/ FILE_FLAG_BACKUP_SEMANTICS or %s\n", temp_path);
|
||||
|
||||
|
||||
/* *** Test opening volumes/devices using drive letter *** */
|
||||
|
@ -879,7 +889,8 @@ static void test_CreateFileA(void)
|
|||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
|
||||
if (hFile != INVALID_HANDLE_VALUE || GetLastError() != ERROR_ACCESS_DENIED)
|
||||
if (hFile != INVALID_HANDLE_VALUE ||
|
||||
(GetLastError() != ERROR_ACCESS_DENIED && GetLastError() != ERROR_BAD_NETPATH))
|
||||
{
|
||||
/* if we have adm rights to volume, then try rest of tests */
|
||||
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA did not open %s, last error=%u\n",
|
||||
|
@ -946,6 +957,9 @@ static void test_CreateFileA(void)
|
|||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
CloseHandle( hFile );
|
||||
}
|
||||
/* If we see ERROR_BAD_NETPATH then on Win9x or WinME, so skip */
|
||||
else if (GetLastError() == ERROR_BAD_NETPATH)
|
||||
skip("Probable Win9x, got ERROR_BAD_NETPATH (53)\n");
|
||||
else
|
||||
skip("Do not have authority to access volumes. Tests skipped\n");
|
||||
|
||||
|
@ -957,78 +971,86 @@ static void test_CreateFileA(void)
|
|||
strcpy(filename, "c:\\");
|
||||
filename[0] = windowsdir[0];
|
||||
ret = pGetVolumeNameForVolumeMountPointA( filename, Volume_1, MAX_PATH );
|
||||
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
|
||||
ok(strlen(Volume_1) == 49, "GetVolumeNameForVolumeMountPointA returned wrong length name %s\n", Volume_1);
|
||||
ok(ret, "GetVolumeNameForVolumeMountPointA failed, for %s, last error=%d\n", filename, GetLastError());
|
||||
if (ret)
|
||||
{
|
||||
ok(strlen(Volume_1) == 49, "GetVolumeNameForVolumeMountPointA returned wrong length name <%s>\n", Volume_1);
|
||||
|
||||
/* test the result of opening a unique volume name (GUID) */
|
||||
/* with the trailing \ */
|
||||
/* this should error out */
|
||||
strcpy(filename, Volume_1);
|
||||
hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
|
||||
/* test the result of opening a unique volume name (GUID)
|
||||
* with the trailing \
|
||||
* this should error out
|
||||
*/
|
||||
strcpy(filename, Volume_1);
|
||||
hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
|
||||
todo_wine
|
||||
ok(hFile == INVALID_HANDLE_VALUE,
|
||||
"CreateFileA should not have opened %s, hFile %p\n",
|
||||
filename, hFile);
|
||||
todo_wine
|
||||
ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
|
||||
"CreateFileA should have returned ERROR_PATH_NOT_FOUND on %s, but got %u\n",
|
||||
filename, GetLastError());
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
CloseHandle( hFile );
|
||||
todo_wine
|
||||
ok(hFile == INVALID_HANDLE_VALUE,
|
||||
"CreateFileA should not have opened %s, hFile %p\n",
|
||||
filename, hFile);
|
||||
todo_wine
|
||||
ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND,
|
||||
"CreateFileA should have returned ERROR_PATH_NOT_FOUND on %s, but got %u\n",
|
||||
filename, GetLastError());
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
CloseHandle( hFile );
|
||||
|
||||
/* test the result of opening a unique volume name (GUID) */
|
||||
/* with the temp path string as dir */
|
||||
/* this should work */
|
||||
strcpy(filename, Volume_1);
|
||||
strcat(filename, temp_path+3);
|
||||
hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
|
||||
/* test the result of opening a unique volume name (GUID)
|
||||
* with the temp path string as dir
|
||||
* this should work
|
||||
*/
|
||||
strcpy(filename, Volume_1);
|
||||
strcat(filename, temp_path+3);
|
||||
hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL );
|
||||
todo_wine
|
||||
ok(hFile != INVALID_HANDLE_VALUE,
|
||||
"CreateFileA should have opened %s, but got %u\n",
|
||||
filename, GetLastError());
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
CloseHandle( hFile );
|
||||
todo_wine
|
||||
ok(hFile != INVALID_HANDLE_VALUE,
|
||||
"CreateFileA should have opened %s, but got %u\n",
|
||||
filename, GetLastError());
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
CloseHandle( hFile );
|
||||
|
||||
/* test the result of opening a unique volume name (GUID) */
|
||||
/* without the trailing \ and in device namespace */
|
||||
/* this should work */
|
||||
strcpy(filename, Volume_1);
|
||||
filename[2] = '.';
|
||||
filename[48] = 0;
|
||||
hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
|
||||
/* test the result of opening a unique volume name (GUID)
|
||||
* without the trailing \ and in device namespace
|
||||
* this should work
|
||||
*/
|
||||
strcpy(filename, Volume_1);
|
||||
filename[2] = '.';
|
||||
filename[48] = 0;
|
||||
hFile = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL );
|
||||
if (hFile != INVALID_HANDLE_VALUE || GetLastError() != ERROR_ACCESS_DENIED)
|
||||
{
|
||||
/* if we have adm rights to volume, then try rest of tests */
|
||||
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA did not open %s, last error=%u\n",
|
||||
filename, GetLastError());
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
if (hFile != INVALID_HANDLE_VALUE || GetLastError() != ERROR_ACCESS_DENIED)
|
||||
{
|
||||
/* if we opened the volume/device, try to read it. Since it */
|
||||
/* opened, we should be able to read it. We don't care about*/
|
||||
/* what the data is at this time. */
|
||||
len = 512;
|
||||
ret = ReadFile( hFile, buffer, len, &len, NULL );
|
||||
todo_wine ok(ret, "Failed to read volume, last error %u, %u, for %s\n",
|
||||
GetLastError(), ret, filename);
|
||||
if (ret)
|
||||
/* if we have adm rights to volume, then try rest of tests */
|
||||
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA did not open %s, last error=%u\n",
|
||||
filename, GetLastError());
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
trace("buffer is\n");
|
||||
dumpmem(buffer, 64);
|
||||
}
|
||||
CloseHandle( hFile );
|
||||
}
|
||||
/* if we opened the volume/device, try to read it. Since it */
|
||||
/* opened, we should be able to read it. We don't care about*/
|
||||
/* what the data is at this time. */
|
||||
len = 512;
|
||||
ret = ReadFile( hFile, buffer, len, &len, NULL );
|
||||
todo_wine ok(ret, "Failed to read volume, last error %u, %u, for %s\n",
|
||||
GetLastError(), ret, filename);
|
||||
if (ret)
|
||||
{
|
||||
trace("buffer is\n");
|
||||
dumpmem(buffer, 64);
|
||||
}
|
||||
CloseHandle( hFile );
|
||||
}
|
||||
}
|
||||
else
|
||||
skip("Do not have authority to access volumes. Tests skipped\n");
|
||||
}
|
||||
else
|
||||
skip("Do not have authority to access volumes. Tests skipped\n");
|
||||
win_skip("GetVolumeNameForVolumeMountPointA not functioning\n");
|
||||
}
|
||||
else
|
||||
win_skip("GetVolumeNameForVolumeMountPointA not found\n");
|
||||
|
|
|
@ -836,6 +836,7 @@ static int test_DisconnectNamedPipe(void)
|
|||
char ibuf[32];
|
||||
DWORD written;
|
||||
DWORD readden;
|
||||
DWORD ret;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
hnp = CreateNamedPipe(PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT,
|
||||
|
@ -876,6 +877,8 @@ static int test_DisconnectNamedPipe(void)
|
|||
"ReadFile from disconnected pipe with bytes waiting\n");
|
||||
ok(!DisconnectNamedPipe(hnp) && GetLastError() == ERROR_PIPE_NOT_CONNECTED,
|
||||
"DisconnectNamedPipe worked twice\n");
|
||||
ret = WaitForSingleObject(hFile, 0);
|
||||
ok(ret == WAIT_TIMEOUT, "WaitForSingleObject returned %X\n", ret);
|
||||
ok(CloseHandle(hFile), "CloseHandle\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,12 @@
|
|||
ok((expected) == value, "Expected " #actual " to be %d (" #expected ") is %d\n", \
|
||||
(expected), value); \
|
||||
} while (0)
|
||||
#define expect_eq_s(expected, actual) \
|
||||
do { \
|
||||
LPCSTR value = (actual); \
|
||||
ok(lstrcmpA((expected), value) == 0, "Expected " #actual " to be L\"%s\" (" #expected ") is L\"%s\"\n", \
|
||||
expected, value); \
|
||||
} while (0)
|
||||
#define expect_eq_ws_i(expected, actual) \
|
||||
do { \
|
||||
LPCWSTR value = (actual); \
|
||||
|
@ -70,6 +76,7 @@ static const char *wine_dbgstr_w(LPCWSTR wstr)
|
|||
static HINSTANCE hkernel32;
|
||||
static LPVOID (WINAPI *pVirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD);
|
||||
static BOOL (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD);
|
||||
static BOOL (WINAPI *pQueryFullProcessImageNameA)(HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD lpdwSize);
|
||||
static BOOL (WINAPI *pQueryFullProcessImageNameW)(HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD lpdwSize);
|
||||
|
||||
/* ############################### */
|
||||
|
@ -208,6 +215,7 @@ static int init(void)
|
|||
hkernel32 = GetModuleHandleA("kernel32");
|
||||
pVirtualAllocEx = (void *) GetProcAddress(hkernel32, "VirtualAllocEx");
|
||||
pVirtualFreeEx = (void *) GetProcAddress(hkernel32, "VirtualFreeEx");
|
||||
pQueryFullProcessImageNameA = (void *) GetProcAddress(hkernel32, "QueryFullProcessImageNameA");
|
||||
pQueryFullProcessImageNameW = (void *) GetProcAddress(hkernel32, "QueryFullProcessImageNameW");
|
||||
return 1;
|
||||
}
|
||||
|
@ -1620,6 +1628,53 @@ static void test_GetProcessVersion(void)
|
|||
CloseHandle(pi.hThread);
|
||||
}
|
||||
|
||||
static void test_ProcessNameA(void)
|
||||
{
|
||||
#define INIT_STR "Just some words"
|
||||
DWORD length, size;
|
||||
CHAR buf[1024];
|
||||
|
||||
if (!pQueryFullProcessImageNameA)
|
||||
{
|
||||
win_skip("QueryFullProcessImageNameA unavailable (added in Windows Vista)\n");
|
||||
return;
|
||||
}
|
||||
/* get the buffer length without \0 terminator */
|
||||
length = 1024;
|
||||
expect_eq_d(TRUE, pQueryFullProcessImageNameA(GetCurrentProcess(), 0, buf, &length));
|
||||
expect_eq_d(length, lstrlenA(buf));
|
||||
|
||||
/* when the buffer is too small
|
||||
* - function fail with error ERROR_INSUFFICIENT_BUFFER
|
||||
* - the size variable is not modified
|
||||
* tested with the biggest too small size
|
||||
*/
|
||||
size = length;
|
||||
sprintf(buf,INIT_STR);
|
||||
expect_eq_d(FALSE, pQueryFullProcessImageNameA(GetCurrentProcess(), 0, buf, &size));
|
||||
expect_eq_d(ERROR_INSUFFICIENT_BUFFER, GetLastError());
|
||||
expect_eq_d(length, size);
|
||||
expect_eq_s(INIT_STR, buf);
|
||||
|
||||
/* retest with smaller buffer size
|
||||
*/
|
||||
size = 4;
|
||||
sprintf(buf,INIT_STR);
|
||||
expect_eq_d(FALSE, pQueryFullProcessImageNameA(GetCurrentProcess(), 0, buf, &size));
|
||||
expect_eq_d(ERROR_INSUFFICIENT_BUFFER, GetLastError());
|
||||
expect_eq_d(4, size);
|
||||
expect_eq_s(INIT_STR, buf);
|
||||
|
||||
/* this is a difference between the ascii and the unicode version
|
||||
* the unicode version crashes when the size is big enough to hold the result
|
||||
* ascii version throughs an error
|
||||
*/
|
||||
size = 1024;
|
||||
expect_eq_d(FALSE, pQueryFullProcessImageNameA(GetCurrentProcess(), 0, NULL, &size));
|
||||
expect_eq_d(1024, size);
|
||||
expect_eq_d(ERROR_INVALID_PARAMETER, GetLastError());
|
||||
}
|
||||
|
||||
static void test_ProcessName(void)
|
||||
{
|
||||
HANDLE hSelf;
|
||||
|
@ -1743,6 +1798,7 @@ START_TEST(process)
|
|||
test_ExitCode();
|
||||
test_OpenProcess();
|
||||
test_GetProcessVersion();
|
||||
test_ProcessNameA();
|
||||
test_ProcessName();
|
||||
test_Handles();
|
||||
/* things that can be tested:
|
||||
|
|
Loading…
Reference in a new issue