[the_other_devmgmt] Convert the bootstrap app back to C.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 18 Oct 2015 21:27:23 +0000 (21:27 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 18 Oct 2015 21:27:23 +0000 (21:27 +0000)
svn path=/trunk/; revision=69607

reactos/base/applications/mscutils/devmgmt/CMakeLists.txt
reactos/base/applications/mscutils/devmgmt/devmgmt.c
reactos/base/applications/mscutils/devmgmt/devmgmt.cpp [deleted file]
reactos/base/applications/mscutils/devmgmt/devmgmt.h [deleted file]

index de26cd9..d258b19 100644 (file)
@@ -1,11 +1,7 @@
 
-set_cpp(WITH_RTTI WITH_RUNTIME)
+include_directories(${REACTOS_SOURCE_DIR}/include/reactos/dll/devmgr)
 
-include_directories(${REACTOS_SOURCE_DIR}/include/reactos/dll)
-
-list(APPEND SOURCE devmgmt.cpp)
-
-add_executable(devmgmt ${SOURCE} devmgmt.rc)
+add_executable(devmgmt devmgmt.c devmgmt.rc)
 set_module_type(devmgmt win32gui UNICODE)
-add_importlibs(devmgmt setupapi gdi32 user32 comctl32 advapi32 devmgr msvcrt kernel32)
+add_importlibs(devmgmt devmgr msvcrt kernel32)
 add_cd_file(TARGET devmgmt DESTINATION reactos/system32 FOR all)
index 69ebea5..2c61051 100644 (file)
@@ -2,89 +2,31 @@
  * PROJECT:     ReactOS Device Managment
  * LICENSE:     GPL - See COPYING in the top level directory
  * FILE:        base/applications/mscutils/devmgmt/devmgmt.c
- * PURPOSE:     Program HQ
+ * PURPOSE:     Bootstrap for the device manager
  * COPYRIGHT:   Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
- *
  */
 
-#include "precomp.h"
+#define WIN32_NO_STATUS
+#include <windef.h>
+#include <winbase.h>
+#include <winreg.h>
 
-#include <winnls.h>
-
-HINSTANCE hInstance;
-HANDLE ProcessHeap;
-HANDLE hMutex;
+#include <cfgmgr32.h>
+#include <devmgr.h>
 
 int WINAPI
-_tWinMain(HINSTANCE hThisInstance,
-          HINSTANCE hPrevInstance,
-          LPTSTR lpCmdLine,
-          int nCmdShow)
+wWinMain(HINSTANCE hThisInstance,
+         HINSTANCE hPrevInstance,
+         LPWSTR lpCmdLine,
+         int nCmdShow)
 {
-    LPTSTR lpAppName;
-    HWND hMainWnd;
-    MSG Msg;
-    int Ret = 1;
-    INITCOMMONCONTROLSEX icex;
-
-    hMutex = CreateMutex(NULL, TRUE, _T("devmgmt_mutex"));
-    if (hMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
-    {
-        if (hMutex)
-        {
-            CloseHandle(hMutex);
-        }
-        return 0;
-    }
-    
-    switch (GetUserDefaultUILanguage())
-  {
-    case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
-      SetProcessDefaultLayout(LAYOUT_RTL);
-      break;
-
-    default:
-      break;
-  }
-    
-    hInstance = hThisInstance;
-    ProcessHeap = GetProcessHeap();
-
-    icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
-    icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
-    InitCommonControlsEx(&icex);
-
-    if (!AllocAndLoadString(&lpAppName,
-                            hInstance,
-                            IDS_APPNAME))
-    {
-        return 1;
-    }
-
-    if (InitMainWindowImpl())
+    if (!DeviceManager_ExecuteW(NULL,
+                                hThisInstance,
+                                NULL,
+                                nCmdShow))
     {
-        hMainWnd = CreateMainWindow(lpAppName,
-                                    nCmdShow);
-        if (hMainWnd != NULL)
-        {
-            /* pump the message queue */
-            while( GetMessage( &Msg, NULL, 0, 0 ) )
-            {
-                TranslateMessage(&Msg);
-                DispatchMessage(&Msg);
-
-            }
-
-            Ret = 0;
-        }
-
-        UninitMainWindowImpl();
+        return GetLastError();
     }
 
-    LocalFree((HLOCAL)lpAppName);
-    CloseHandle(hMutex);
-    return Ret;
+    return 0;
 }
-
-
-
diff --git a/reactos/base/applications/mscutils/devmgmt/devmgmt.cpp b/reactos/base/applications/mscutils/devmgmt/devmgmt.cpp
deleted file mode 100644 (file)
index 1256993..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <cfgmgr32.h>
-#include <devmgr/devmgr.h>
-
-int WINAPI
-wWinMain(HINSTANCE hThisInstance,
-         HINSTANCE hPrevInstance,
-         LPWSTR lpCmdLine,
-         int nCmdShow)
-{
-    if (!DeviceManager_ExecuteW(NULL,
-                                hThisInstance,
-                                NULL,
-                                nCmdShow))
-    {
-        return GetLastError();
-    }
-    return 0;
-}
diff --git a/reactos/base/applications/mscutils/devmgmt/devmgmt.h b/reactos/base/applications/mscutils/devmgmt/devmgmt.h
deleted file mode 100644 (file)
index 6f70f09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once