Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c16e7058
Commit
c16e7058
authored
Sep 15, 2005
by
Rein Klazes
Committed by
Alexandre Julliard
Sep 15, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Set the LastError in OpenSCManager in case of errors;
- Accept machine names without a '\\' prefix in OpenSCManager and RegConnectRegistry. - Add a regression test for that.
parent
d64172dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
6 deletions
+36
-6
registry.c
dlls/advapi32/registry.c
+6
-6
service.c
dlls/advapi32/service.c
+1
-0
registry.c
dlls/advapi32/tests/registry.c
+29
-0
No files found.
dlls/advapi32/registry.c
View file @
c16e7058
...
...
@@ -2223,20 +2223,20 @@ LONG WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey,
/* Use the local machine name */
ret
=
RegOpenKeyW
(
hKey
,
NULL
,
phkResult
);
}
else
if
(
lpMachineName
[
0
]
!=
'\\'
||
lpMachineName
[
1
]
!=
'\\'
)
ret
=
ERROR_BAD_NETPATH
;
else
{
else
{
WCHAR
compName
[
MAX_COMPUTERNAME_LENGTH
+
1
];
DWORD
len
=
sizeof
(
compName
)
/
sizeof
(
WCHAR
);
/* MSDN says lpMachineName must start with \\ : not so */
if
(
lpMachineName
[
0
]
==
'\\'
&&
lpMachineName
[
1
]
==
'\\'
)
lpMachineName
+=
2
;
if
(
GetComputerNameW
(
compName
,
&
len
))
{
if
(
!
strcmpiW
(
lpMachineName
+
2
,
compName
))
if
(
!
strcmpiW
(
lpMachineName
,
compName
))
ret
=
RegOpenKeyW
(
hKey
,
NULL
,
phkResult
);
else
{
FIXME
(
"C
annot connect to %s
\n
"
,
debugstr_w
(
lpMachineName
));
FIXME
(
"C
onnect to %s is not supported.
\n
"
,
debugstr_w
(
lpMachineName
));
ret
=
ERROR_BAD_NETPATH
;
}
}
...
...
dlls/advapi32/service.c
View file @
c16e7058
...
...
@@ -1000,6 +1000,7 @@ SC_HANDLE WINAPI OpenSCManagerW( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
error:
sc_handle_free
(
&
manager
->
hdr
);
SetLastError
(
r
);
return
NULL
;
}
...
...
dlls/advapi32/tests/registry.c
View file @
c16e7058
...
...
@@ -24,6 +24,7 @@
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winsvc.h"
#include "winerror.h"
static
HKEY
hkey_main
;
...
...
@@ -593,6 +594,32 @@ static BOOL set_privileges(LPCSTR privilege, BOOL set)
return
TRUE
;
}
/* tests that show that RegConnectRegistry and
OpenSCManager accept computer names without the
\\ prefix (what MSDN says). */
static
void
test_regconnectregistry
(
void
)
{
CHAR
compName
[
MAX_COMPUTERNAME_LENGTH
+
1
];
DWORD
len
=
sizeof
(
compName
)
;
BOOL
ret
;
LONG
retl
;
HKEY
hkey
;
SC_HANDLE
schnd
;
ret
=
GetComputerNameA
(
compName
,
&
len
);
ok
(
ret
,
"GetComputerName failed err = %ld
\n
"
,
GetLastError
());
if
(
!
ret
)
return
;
retl
=
RegConnectRegistryA
(
compName
,
HKEY_LOCAL_MACHINE
,
&
hkey
);
ok
(
!
retl
,
"RegConnectRegistryA failed err = %ld
\n
"
,
retl
);
if
(
!
retl
)
RegCloseKey
(
hkey
);
schnd
=
OpenSCManagerA
(
compName
,
NULL
,
GENERIC_READ
);
ok
(
schnd
!=
NULL
,
"OpenSCManagerA failed err = %ld
\n
"
,
GetLastError
());
CloseServiceHandle
(
schnd
);
}
START_TEST
(
registry
)
{
setup_main_key
();
...
...
@@ -619,4 +646,6 @@ START_TEST(registry)
/* cleanup */
delete_key
(
hkey_main
);
test_regconnectregistry
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment