mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 10:12:58 +00:00
initialize COM on demand only
svn path=/trunk/; revision=18181
This commit is contained in:
parent
22f369c6b1
commit
0a52c57489
2 changed files with 17 additions and 19 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <objsel.h>
|
#include <objsel.h>
|
||||||
|
#include <objbase.h>
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "regproc.h"
|
#include "regproc.h"
|
||||||
|
@ -680,6 +681,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
HRESULT hRet;
|
HRESULT hRet;
|
||||||
|
|
||||||
|
hRet = CoInitialize(NULL);
|
||||||
|
if (SUCCEEDED(hRet))
|
||||||
|
{
|
||||||
hRet = InitializeRemoteRegistryPicker(&ObjectPicker);
|
hRet = InitializeRemoteRegistryPicker(&ObjectPicker);
|
||||||
if (SUCCEEDED(hRet))
|
if (SUCCEEDED(hRet))
|
||||||
{
|
{
|
||||||
|
@ -695,6 +699,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
FreeObjectPicker(ObjectPicker);
|
FreeObjectPicker(ObjectPicker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case ID_REGISTRY_DISCONNECTNETWORKREGISTRY:
|
case ID_REGISTRY_DISCONNECTNETWORKREGISTRY:
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <aclui.h>
|
#include <aclui.h>
|
||||||
#include <cguid.h>
|
#include <cguid.h>
|
||||||
#include <objbase.h>
|
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "hexedit.h"
|
#include "hexedit.h"
|
||||||
|
@ -190,7 +189,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HACCEL hAccel;
|
HACCEL hAccel;
|
||||||
HRESULT hComInit;
|
|
||||||
/*
|
/*
|
||||||
int hCrt;
|
int hCrt;
|
||||||
FILE *hf;
|
FILE *hf;
|
||||||
|
@ -224,9 +223,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
}
|
}
|
||||||
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);
|
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);
|
||||||
|
|
||||||
/* initialize the COM library for the remote registry object picker dialog */
|
|
||||||
hComInit = CoInitialize(NULL);
|
|
||||||
|
|
||||||
/* Main message loop */
|
/* Main message loop */
|
||||||
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
|
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
|
||||||
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)
|
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)
|
||||||
|
@ -236,11 +232,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hComInit))
|
|
||||||
{
|
|
||||||
CoUninitialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
ExitInstance(hInstance);
|
ExitInstance(hInstance);
|
||||||
return msg.wParam;
|
return msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue