[the_other_devmgmt] Convert the bootstrap app back to C.

svn path=/trunk/; revision=69607
This commit is contained in:
Hermès Bélusca-Maïto 2015-10-18 21:27:23 +00:00
parent 2a8b2a3a1b
commit 1cfc6d4fb5
4 changed files with 20 additions and 103 deletions

View 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)

View 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 (!DeviceManager_ExecuteW(NULL,
hThisInstance,
NULL,
nCmdShow))
{
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;
return GetLastError();
}
if (InitMainWindowImpl())
{
hMainWnd = CreateMainWindow(lpAppName,
nCmdShow);
if (hMainWnd != NULL)
{
/* pump the message queue */
while( GetMessage( &Msg, NULL, 0, 0 ) )
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
Ret = 0;
}
UninitMainWindowImpl();
}
LocalFree((HLOCAL)lpAppName);
CloseHandle(hMutex);
return Ret;
return 0;
}

View file

@ -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;
}

View file

@ -1 +0,0 @@
#pragma once