mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[ADVAPI32_APITEST] - Test passing tag, but no group to CreateService
[KMTESTS/MM] - MmSection: Wait for write completion to prevent a random test failure svn path=/trunk/; revision=53943
This commit is contained in:
parent
8b7dad6466
commit
e69656b340
2 changed files with 62 additions and 23 deletions
|
@ -66,12 +66,28 @@ static int MakeService(SC_HANDLE hScm, const wchar_t *serviceName, SC_HANDLE *hS
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void DestroyService(SC_HANDLE hService)
|
||||
{
|
||||
LONG ret;
|
||||
|
||||
if (!hService)
|
||||
return;
|
||||
SetLastError(DNS_ERROR_RCODE_NXRRSET);
|
||||
ret = DeleteService(hService);
|
||||
ok(ret == TRUE, "DeleteService returned %ld, expected 1\n", ret);
|
||||
ok(GetLastError() == DNS_ERROR_RCODE_NXRRSET /* win7 */
|
||||
|| GetLastError() == ERROR_SUCCESS /* win2k3 */, "DeleteService GetLastError()=0x%08lx\n", GetLastError());
|
||||
|
||||
CloseServiceHandle(hService);
|
||||
}
|
||||
|
||||
static void Test_CreateService(void)
|
||||
{
|
||||
SC_HANDLE hScm = NULL;
|
||||
SC_HANDLE hService1 = NULL, hService2 = NULL;
|
||||
LONG ret;
|
||||
SC_HANDLE hService3 = NULL;
|
||||
DWORD tag1 = 0, tag2 = 0;
|
||||
DWORD tag3 = 785;
|
||||
|
||||
SetLastError(DNS_ERROR_RCODE_NXRRSET);
|
||||
hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
|
||||
|
@ -92,28 +108,49 @@ static void Test_CreateService(void)
|
|||
|
||||
ok(tag1 != tag2, "tag1=%lu, tag2=%lu\n", tag1, tag2);
|
||||
|
||||
/* ask for a tag, but don't have a group */
|
||||
hService3 = CreateServiceW(
|
||||
hScm,
|
||||
L"advapi32_apitest_CreateService_Test_Service2",
|
||||
NULL,
|
||||
DELETE,
|
||||
SERVICE_KERNEL_DRIVER,
|
||||
SERVICE_BOOT_START,
|
||||
SERVICE_ERROR_IGNORE,
|
||||
L"%systemroot%\\drivers\\win32k.sys",
|
||||
NULL,
|
||||
&tag3,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
ok(hService3 == NULL, "hService3=%p\n", hService3);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "error=%lu\n", GetLastError());
|
||||
ok(tag3 == 785, "tag3=%lu\n", tag3);
|
||||
DestroyService(hService3);
|
||||
|
||||
hService3 = CreateServiceW(
|
||||
hScm,
|
||||
L"advapi32_apitest_CreateService_Test_Service2",
|
||||
NULL,
|
||||
DELETE,
|
||||
SERVICE_KERNEL_DRIVER,
|
||||
SERVICE_BOOT_START,
|
||||
SERVICE_ERROR_IGNORE,
|
||||
L"%systemroot%\\drivers\\win32k.sys",
|
||||
L"",
|
||||
&tag3,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
ok(hService3 == NULL, "hService3=%p\n", hService3);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "error=%lu\n", GetLastError());
|
||||
ok(tag3 == 785, "tag3=%lu\n", tag3);
|
||||
DestroyService(hService3);
|
||||
|
||||
cleanup:
|
||||
if (hService2)
|
||||
{
|
||||
SetLastError(DNS_ERROR_RCODE_NXRRSET);
|
||||
ret = DeleteService(hService2);
|
||||
ok(ret == TRUE, "DeleteService returned %ld, expected 1\n", ret);
|
||||
ok(GetLastError() == DNS_ERROR_RCODE_NXRRSET /* win7 */
|
||||
|| GetLastError() == ERROR_SUCCESS /* win2k3 */, "DeleteService (Error: %ld)\n", GetLastError());
|
||||
|
||||
CloseServiceHandle(hService2);
|
||||
}
|
||||
|
||||
if (hService1)
|
||||
{
|
||||
SetLastError(DNS_ERROR_RCODE_NXRRSET);
|
||||
ret = DeleteService(hService1);
|
||||
ok(ret == TRUE, "DeleteService returned %ld, expected 1\n", ret);
|
||||
ok(GetLastError() == DNS_ERROR_RCODE_NXRRSET /* win7 */
|
||||
|| GetLastError() == ERROR_SUCCESS /* win2k3 */, "DeleteService (Error: %ld)\n", GetLastError());
|
||||
|
||||
CloseServiceHandle(hService1);
|
||||
}
|
||||
DestroyService(hService2);
|
||||
DestroyService(hService1);
|
||||
|
||||
if (hScm)
|
||||
CloseServiceHandle(hScm);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
NTSTATUS Status; \
|
||||
if (skip(SectionObject != NULL && \
|
||||
SectionObject != (PVOID)0x5555555555555555ULL, \
|
||||
"blah\n")) \
|
||||
"No section object\n")) \
|
||||
break; \
|
||||
Status = ObOpenObjectByPointer(SectionObject, OBJ_KERNEL_HANDLE, \
|
||||
NULL, 0, MmSectionObjectType, \
|
||||
|
@ -401,7 +401,7 @@ START_TEST(MmSection)
|
|||
ok(ExGetPreviousMode() == UserMode, "Previous mode is kernel mode\n");
|
||||
/* create a one-byte file that we can use */
|
||||
InitializeObjectAttributes(&ObjectAttributes, &FileName1, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
||||
Status = ZwCreateFile(&FileHandle1, GENERIC_ALL, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_SUPERSEDE, FILE_NON_DIRECTORY_FILE, NULL, 0);
|
||||
Status = ZwCreateFile(&FileHandle1, GENERIC_WRITE | SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_SUPERSEDE, FILE_NON_DIRECTORY_FILE, NULL, 0);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
ok_eq_ulongptr(IoStatusBlock.Information, FILE_CREATED);
|
||||
ok(FileHandle1 != NULL, "FileHandle1 is NULL\n");
|
||||
|
@ -409,6 +409,8 @@ START_TEST(MmSection)
|
|||
{
|
||||
FileOffset.QuadPart = 0;
|
||||
Status = ZwWriteFile(FileHandle1, NULL, NULL, NULL, &IoStatusBlock, &FileData, sizeof FileData, &FileOffset, NULL);
|
||||
ok(Status == STATUS_SUCCESS || Status == STATUS_PENDING, "Status = 0x%08lx\n", Status);
|
||||
Status = ZwWaitForSingleObject(FileHandle1, FALSE, NULL);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
ok_eq_ulongptr(IoStatusBlock.Information, 1);
|
||||
Status = ZwClose(FileHandle1);
|
||||
|
|
Loading…
Reference in a new issue