Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
9ea9eaaa
Commit
9ea9eaaa
authored
Mar 25, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Mar 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Create MachineGuid value if it doesn't exist.
parent
4c984e08
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
2 deletions
+52
-2
crypt.c
dlls/advapi32/crypt.c
+52
-0
crypt.c
dlls/advapi32/tests/crypt.c
+0
-2
No files found.
dlls/advapi32/crypt.c
View file @
9ea9eaaa
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
#include "crypt.h"
#include "crypt.h"
#include "winnls.h"
#include "winnls.h"
#include "winreg.h"
#include "winreg.h"
#include "rpc.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/unicode.h"
#include "winternl.h"
#include "winternl.h"
...
@@ -266,6 +267,54 @@ error:
...
@@ -266,6 +267,54 @@ error:
#undef CRYPT_GetProvFuncOpt
#undef CRYPT_GetProvFuncOpt
static
void
CRYPT_CreateMachineGuid
(
void
)
{
static
const
WCHAR
cryptographyW
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'C'
,
'r'
,
'y'
,
'p'
,
't'
,
'o'
,
'g'
,
'r'
,
'a'
,
'p'
,
'h'
,
'y'
,
0
};
static
const
WCHAR
machineGuidW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'G'
,
'u'
,
'i'
,
'd'
,
0
};
LONG
r
;
HKEY
key
;
r
=
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
cryptographyW
,
0
,
KEY_ALL_ACCESS
,
&
key
);
if
(
!
r
)
{
DWORD
size
;
r
=
RegQueryValueExW
(
key
,
machineGuidW
,
NULL
,
NULL
,
NULL
,
&
size
);
if
(
r
==
ERROR_FILE_NOT_FOUND
)
{
static
const
WCHAR
rpcrt4
[]
=
{
'r'
,
'p'
,
'c'
,
'r'
,
't'
,
'4'
,
0
};
HMODULE
lib
=
LoadLibraryW
(
rpcrt4
);
if
(
lib
)
{
RPC_STATUS
(
RPC_ENTRY
*
pUuidCreate
)(
UUID
*
);
RPC_STATUS
(
RPC_ENTRY
*
pUuidToString
)(
UUID
*
,
WCHAR
**
);
RPC_STATUS
(
RPC_ENTRY
*
pRpcStringFree
)(
WCHAR
**
);
UUID
uuid
;
WCHAR
*
uuidStr
;
pUuidCreate
=
GetProcAddress
(
lib
,
"UuidCreate"
);
pUuidToString
=
GetProcAddress
(
lib
,
"UuidToStringW"
);
pRpcStringFree
=
GetProcAddress
(
lib
,
"RpcStringFreeW"
);
pUuidCreate
(
&
uuid
);
pUuidToString
(
&
uuid
,
&
uuidStr
);
RegSetValueExW
(
key
,
machineGuidW
,
0
,
REG_SZ
,
(
const
BYTE
*
)
uuidStr
,
(
lstrlenW
(
uuidStr
)
+
1
)
*
sizeof
(
WCHAR
));
pRpcStringFree
(
&
uuidStr
);
FreeLibrary
(
lib
);
}
}
RegCloseKey
(
key
);
}
}
/******************************************************************************
/******************************************************************************
* CryptAcquireContextW (ADVAPI32.@)
* CryptAcquireContextW (ADVAPI32.@)
*
*
...
@@ -309,6 +358,9 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
...
@@ -309,6 +358,9 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
return
FALSE
;
return
FALSE
;
}
}
/* Make sure the MachineGuid value exists */
CRYPT_CreateMachineGuid
();
if
(
!
pszProvider
||
!*
pszProvider
)
if
(
!
pszProvider
||
!*
pszProvider
)
{
{
/* No CSP name specified so try the user default CSP first
/* No CSP name specified so try the user default CSP first
...
...
dlls/advapi32/tests/crypt.c
View file @
9ea9eaaa
...
@@ -907,10 +907,8 @@ static void test_machine_guid(void)
...
@@ -907,10 +907,8 @@ static void test_machine_guid(void)
/* Check that MachineGuid was created */
/* Check that MachineGuid was created */
size
=
sizeof
(
guid
);
size
=
sizeof
(
guid
);
r
=
RegQueryValueExA
(
key
,
"MachineGuid"
,
NULL
,
NULL
,
(
BYTE
*
)
guid
,
&
size
);
r
=
RegQueryValueExA
(
key
,
"MachineGuid"
,
NULL
,
NULL
,
(
BYTE
*
)
guid
,
&
size
);
todo_wine
ok
(
!
r
,
"expected to find MachineGuid: %d
\n
"
,
r
);
ok
(
!
r
,
"expected to find MachineGuid: %d
\n
"
,
r
);
r
=
RegDeleteValueA
(
key
,
"MachineGuid"
);
r
=
RegDeleteValueA
(
key
,
"MachineGuid"
);
todo_wine
ok
(
!
r
,
"RegDeleteValueA failed: %d
\n
"
,
r
);
ok
(
!
r
,
"RegDeleteValueA failed: %d
\n
"
,
r
);
if
(
restoreGuid
)
if
(
restoreGuid
)
RegSetValueExA
(
key
,
"MachineGuid"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
originalGuid
,
RegSetValueExA
(
key
,
"MachineGuid"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
originalGuid
,
...
...
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