- RegConnectRegistryA fails on Win9x when Remote Registry Service is

not installed (WinReg.DLL is missing).
- Test "\\" prefixed computer names too.
This commit is contained in:
Saulius Krasuckas 2005-11-04 11:15:59 +00:00 committed by Alexandre Julliard
parent 85b3f37d31
commit 9d519093f6
1 changed files with 19 additions and 2 deletions

View File

@ -601,22 +601,39 @@ static BOOL set_privileges(LPCSTR privilege, BOOL set)
static void test_regconnectregistry( void) static void test_regconnectregistry( void)
{ {
CHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; CHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
CHAR netwName[MAX_COMPUTERNAME_LENGTH + 3]; /* 2 chars for double backslash */
DWORD len = sizeof(compName) ; DWORD len = sizeof(compName) ;
BOOL ret; BOOL ret;
LONG retl; LONG retl;
HKEY hkey; HKEY hkey;
SC_HANDLE schnd; SC_HANDLE schnd;
DWORD GLE;
ret = GetComputerNameA(compName, &len); ret = GetComputerNameA(compName, &len);
ok( ret, "GetComputerName failed err = %ld\n", GetLastError()); ok( ret, "GetComputerName failed err = %ld\n", GetLastError());
if( !ret) return; if( !ret) return;
lstrcpyA(netwName, "\\\\");
lstrcpynA(netwName+2, compName, MAX_COMPUTERNAME_LENGTH + 1);
retl = RegConnectRegistryA( compName, HKEY_LOCAL_MACHINE, &hkey); retl = RegConnectRegistryA( compName, HKEY_LOCAL_MACHINE, &hkey);
ok( !retl, "RegConnectRegistryA failed err = %ld\n", retl); ok( !retl || retl == ERROR_DLL_INIT_FAILED, "RegConnectRegistryA failed err = %ld\n", retl);
if( !retl) RegCloseKey( hkey);
retl = RegConnectRegistryA( netwName, HKEY_LOCAL_MACHINE, &hkey);
ok( !retl || retl == ERROR_DLL_INIT_FAILED, "RegConnectRegistryA failed err = %ld\n", retl);
if( !retl) RegCloseKey( hkey); if( !retl) RegCloseKey( hkey);
schnd = OpenSCManagerA( compName, NULL, GENERIC_READ); schnd = OpenSCManagerA( compName, NULL, GENERIC_READ);
ok( schnd != NULL, "OpenSCManagerA failed err = %ld\n", GetLastError()); GLE = GetLastError();
ok( schnd != NULL || GLE==ERROR_CALL_NOT_IMPLEMENTED,
"OpenSCManagerA failed err = %ld\n", GLE);
CloseServiceHandle( schnd);
schnd = OpenSCManagerA( netwName, NULL, GENERIC_READ);
GLE = GetLastError();
ok( schnd != NULL || GLE==ERROR_CALL_NOT_IMPLEMENTED,
"OpenSCManagerA failed err = %ld\n", GLE);
CloseServiceHandle( schnd); CloseServiceHandle( schnd);
} }