Author: cwittich
Date: Mon May 27 18:33:18 2013
New Revision: 59090
URL:
http://svn.reactos.org/svn/reactos?rev=59090&view=rev
Log:
[devmgr]
add "update driver" button
not functional due to unimplemented DiShowUpdateDevice
Modified:
trunk/reactos/dll/win32/devmgr/CMakeLists.txt
trunk/reactos/dll/win32/devmgr/advprop.c
trunk/reactos/dll/win32/devmgr/lang/de-DE.rc
trunk/reactos/dll/win32/devmgr/lang/en-US.rc
trunk/reactos/dll/win32/devmgr/precomp.h
trunk/reactos/dll/win32/devmgr/resource.h
trunk/reactos/dll/win32/newdev/stubs.c
Modified: trunk/reactos/dll/win32/devmgr/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/CMakeList…
==============================================================================
--- trunk/reactos/dll/win32/devmgr/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/CMakeLists.txt [iso-8859-1] Mon May 27 18:33:18 2013
@@ -18,6 +18,7 @@
add_importlibs(devmgr
setupapi
advapi32
+ newdev
user32
version
msvcrt
Modified: trunk/reactos/dll/win32/devmgr/advprop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/advprop.c…
==============================================================================
--- trunk/reactos/dll/win32/devmgr/advprop.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/advprop.c [iso-8859-1] Mon May 27 18:33:18 2013
@@ -556,6 +556,56 @@
hwndDlg,
DriverDetailsDlgProc,
(ULONG_PTR)dap);
+ break;
+ }
+ case IDC_UPDATEDRIVER:
+ {
+ if (dap->CurrentDeviceInfoSet != INVALID_HANDLE_VALUE)
+ {
+ BOOL NeedReboot;
+ if (DiShowUpdateDevice(hwndDlg, dap->CurrentDeviceInfoSet,
&dap->CurrentDeviceInfoData, 0, &NeedReboot))
+ {
+ if (NeedReboot)
+ {
+ //FIXME: load text from resource file
+ if(MessageBoxW(hwndDlg, L"Reboot now?",
L"Reboot required", MB_YESNO | MB_ICONQUESTION) == IDYES)
+ {
+ HANDLE hToken;
+ TOKEN_PRIVILEGES Privileges;
+
+ if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES, &hToken))
+ {
+ DPRINT("OpenProcessToken
failed\n");
+ break;
+ }
+
+ /* Get the LUID for the Shutdown privilege */
+ if (!LookupPrivilegeValueW(NULL,
SE_SHUTDOWN_NAME, &Privileges.Privileges[0].Luid))
+ {
+ DPRINT("LookupPrivilegeValue
failed\n");
+ break;
+ }
+
+ /* Assign the Shutdown privilege to our process
*/
+ Privileges.PrivilegeCount = 1;
+ Privileges.Privileges[0].Attributes =
SE_PRIVILEGE_ENABLED;
+
+ if (!AdjustTokenPrivileges(hToken, FALSE,
&Privileges, 0, NULL, NULL))
+ {
+ DPRINT("AdjustTokenPrivileges
failed\n");
+ break;
+ }
+
+ /* Finally shut down the system */
+ if(!ExitWindowsEx(EWX_POWEROFF,
SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED))
+ {
+ DPRINT("ExitWindowsEx failed\n");
+ break;
+ }
+ }
+ }
+ }
+ }
break;
}
}
Modified: trunk/reactos/dll/win32/devmgr/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/lang/de-D…
==============================================================================
--- trunk/reactos/dll/win32/devmgr/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/lang/de-DE.rc [iso-8859-1] Mon May 27 18:33:18 2013
@@ -172,8 +172,10 @@
EDITTEXT IDC_DRVVERSION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER |
ES_AUTOHSCROLL | ES_READONLY
LTEXT "Signaturgeber:", -1, 37, 81, 60, 8, SS_NOPREFIX
EDITTEXT IDC_DIGITALSIGNER, 100, 81, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER |
ES_AUTOHSCROLL | ES_READONLY
- PUSHBUTTON "&Treiberdetails...", IDC_DRIVERDETAILS, 7, 106, 70, 15
+ PUSHBUTTON "&Treiberdetails...", IDC_DRIVERDETAILS, 7, 106, 75, 15
LTEXT "Einzelheiten über die Treiberdateien anzeigen.", -1, 91, 110, 154,
17, SS_NOPREFIX
+ PUSHBUTTON "Treiber &aktualisieren...", IDC_UPDATEDRIVER, 7, 126, 75,
15
+ LTEXT "Aktualisiert den Gerätetreiber.", -1, 91, 130, 154, 17,
SS_NOPREFIX
END
IDD_DRIVERDETAILS DIALOGEX DISCARDABLE 0, 0, 224, 230
Modified: trunk/reactos/dll/win32/devmgr/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/lang/en-U…
==============================================================================
--- trunk/reactos/dll/win32/devmgr/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/lang/en-US.rc [iso-8859-1] Mon May 27 18:33:18 2013
@@ -172,8 +172,10 @@
EDITTEXT IDC_DRVVERSION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER |
ES_AUTOHSCROLL | ES_READONLY
LTEXT "Digital Signer:", -1, 37, 81, 60, 8, SS_NOPREFIX
EDITTEXT IDC_DIGITALSIGNER, 100, 81, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER |
ES_AUTOHSCROLL | ES_READONLY
- PUSHBUTTON "&Driver Details...", IDC_DRIVERDETAILS, 7, 106, 70, 15
+ PUSHBUTTON "&Driver Details", IDC_DRIVERDETAILS, 7, 106, 75, 15
LTEXT "To view details about the driver files.", -1, 91, 110, 154, 17,
SS_NOPREFIX
+ PUSHBUTTON "&Update Driver...", IDC_UPDATEDRIVER, 7, 126, 75, 15
+ LTEXT "Update the device driver.", -1, 91, 130, 154, 17, SS_NOPREFIX
END
IDD_DRIVERDETAILS DIALOGEX DISCARDABLE 0, 0, 224, 230
Modified: trunk/reactos/dll/win32/devmgr/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/precomp.h…
==============================================================================
--- trunk/reactos/dll/win32/devmgr/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/precomp.h [iso-8859-1] Mon May 27 18:33:18 2013
@@ -8,6 +8,9 @@
#include <regstr.h>
#include <setupapi.h>
#include <cfgmgr32.h>
+#undef WINVER
+#define WINVER _WIN32_WINNT_VISTA
+#include <newdev.h>
#include <dll/devmgr/devmgr.h>
#include "resource.h"
Modified: trunk/reactos/dll/win32/devmgr/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/resource.…
==============================================================================
--- trunk/reactos/dll/win32/devmgr/resource.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/devmgr/resource.h [iso-8859-1] Mon May 27 18:33:18 2013
@@ -40,6 +40,7 @@
#define IDC_FILECOPYRIGHT 0x595
#define IDC_DETAILSPROPNAME 0x596
#define IDC_DETAILSPROPVALUE 0x597
+#define IDC_UPDATEDRIVER 0x598
#define IDS_NAME 0x100
#define IDS_TYPE 0x101
Modified: trunk/reactos/dll/win32/newdev/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/stubs.c?r…
==============================================================================
--- trunk/reactos/dll/win32/newdev/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/newdev/stubs.c [iso-8859-1] Mon May 27 18:33:18 2013
@@ -57,13 +57,19 @@
*/
BOOL WINAPI
DiShowUpdateDevice(
- IN HWND hwndParent OPTIONAL,
- IN HDEVINFO DeviceInfoSet,
- IN PSP_DEVINFO_DATA DeviceInfoData,
- IN DWORD Flags,
- OUT PBOOL NeedReboot OPTIONAL)
+ IN HWND hwndParent OPTIONAL,
+ IN HDEVINFO DeviceInfoSet,
+ IN PSP_DEVINFO_DATA DeviceInfoData,
+ IN DWORD Flags,
+ OUT PBOOL NeedReboot OPTIONAL)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_GEN_FAILURE);
- return FALSE;
+ if (Flags != 0)
+ {
+ SetLastError(ERROR_INVALID_FLAGS);
+ return FALSE;
+ }
+
+ UNIMPLEMENTED;
+ SetLastError(ERROR_GEN_FAILURE);
+ return FALSE;
}