2019-07-10 15:58:48 -07:00
|
|
|
From 58c943a9d3ffc3bd9feae35682710d408448d78a Mon Sep 17 00:00:00 2001
|
2015-05-24 21:10:28 -07:00
|
|
|
From: Sebastian Lackner <sebastian@fds-team.de>
|
|
|
|
Date: Mon, 25 May 2015 06:07:50 +0200
|
2019-01-30 16:08:09 -08:00
|
|
|
Subject: [PATCH] wineboot: Assign a drive serial number during prefix
|
|
|
|
creation/update.
|
2015-05-24 21:10:28 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
programs/wineboot/wineboot.c | 32 ++++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 32 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
|
2019-07-10 15:58:48 -07:00
|
|
|
index 5190dcc701..6e54bff187 100644
|
2015-05-24 21:10:28 -07:00
|
|
|
--- a/programs/wineboot/wineboot.c
|
|
|
|
+++ b/programs/wineboot/wineboot.c
|
2019-07-10 15:58:48 -07:00
|
|
|
@@ -70,6 +70,7 @@
|
2015-05-24 21:10:28 -07:00
|
|
|
#include <shlwapi.h>
|
|
|
|
#include <shellapi.h>
|
2019-07-10 15:58:48 -07:00
|
|
|
#include <setupapi.h>
|
2015-05-24 21:10:28 -07:00
|
|
|
+#include <ntsecapi.h>
|
2019-07-10 15:58:48 -07:00
|
|
|
#include <newdev.h>
|
2015-05-24 21:10:28 -07:00
|
|
|
#include "resource.h"
|
|
|
|
|
2019-07-10 15:58:48 -07:00
|
|
|
@@ -293,6 +294,36 @@ static void get_namestring( WCHAR *buf )
|
2019-07-05 19:41:27 -07:00
|
|
|
for (i = lstrlenW(buf) - 1; i >= 0 && buf[i] == ' '; i--) buf[i] = 0;
|
2015-05-24 21:10:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
+/* set a serial number for the disk containing windows */
|
|
|
|
+static void create_disk_serial_number(void)
|
|
|
|
+{
|
|
|
|
+ static const WCHAR filename[] = {'\\','.','w','i','n','d','o','w','s','-','s','e','r','i','a','l',0};
|
|
|
|
+ DWORD serial, written;
|
|
|
|
+ WCHAR path[MAX_PATH];
|
|
|
|
+ char buffer[16];
|
|
|
|
+ HANDLE file;
|
|
|
|
+
|
|
|
|
+ if (GetSystemDirectoryW( path, sizeof(path)/sizeof(path[0]) ) && path[1] == ':')
|
|
|
|
+ {
|
|
|
|
+ path[2] = 0;
|
2019-07-05 19:41:27 -07:00
|
|
|
+ lstrcatW( path, filename );
|
2015-05-24 21:10:28 -07:00
|
|
|
+ if (!PathFileExistsW( path ) && RtlGenRandom( &serial, sizeof(serial) ))
|
|
|
|
+ {
|
|
|
|
+ WINE_TRACE( "Putting serial number of %08X into file %s\n", serial, wine_dbgstr_w(path) );
|
|
|
|
+ file = CreateFileW( path, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
|
|
|
+ CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
|
|
|
|
+ if (file == INVALID_HANDLE_VALUE)
|
|
|
|
+ WINE_ERR( "wine: failed to create %s.\n", wine_dbgstr_w(path) );
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ sprintf( buffer, "%X\n", serial );
|
|
|
|
+ WriteFile( file, buffer, strlen(buffer), &written, NULL );
|
|
|
|
+ CloseHandle( file );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/* create the volatile hardware registry keys */
|
|
|
|
static void create_hardware_registry_keys(void)
|
|
|
|
{
|
2019-07-10 15:58:48 -07:00
|
|
|
@@ -1420,6 +1451,7 @@ int __cdecl main( int argc, char *argv[] )
|
2015-05-24 21:10:28 -07:00
|
|
|
|
|
|
|
ResetEvent( event ); /* in case this is a restart */
|
|
|
|
|
|
|
|
+ create_disk_serial_number();
|
|
|
|
create_hardware_registry_keys();
|
|
|
|
create_dynamic_registry_keys();
|
|
|
|
create_environment_registry_keys();
|
|
|
|
--
|
2019-07-10 15:58:48 -07:00
|
|
|
2.17.1
|
2015-05-24 21:10:28 -07:00
|
|
|
|