mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +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 <shellapi.h>
|
||||
#include <objsel.h>
|
||||
#include <objbase.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "regproc.h"
|
||||
|
@ -679,20 +680,26 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
IDsObjectPicker *ObjectPicker;
|
||||
WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
HRESULT hRet;
|
||||
|
||||
hRet = InitializeRemoteRegistryPicker(&ObjectPicker);
|
||||
|
||||
hRet = CoInitialize(NULL);
|
||||
if (SUCCEEDED(hRet))
|
||||
{
|
||||
hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker,
|
||||
hWnd,
|
||||
szComputerName,
|
||||
sizeof(szComputerName) / sizeof(szComputerName[0]));
|
||||
if (hRet == S_OK)
|
||||
hRet = InitializeRemoteRegistryPicker(&ObjectPicker);
|
||||
if (SUCCEEDED(hRet))
|
||||
{
|
||||
/* FIXME - connect to the registry */
|
||||
hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker,
|
||||
hWnd,
|
||||
szComputerName,
|
||||
sizeof(szComputerName) / sizeof(szComputerName[0]));
|
||||
if (hRet == S_OK)
|
||||
{
|
||||
/* FIXME - connect to the registry */
|
||||
}
|
||||
|
||||
FreeObjectPicker(ObjectPicker);
|
||||
}
|
||||
|
||||
FreeObjectPicker(ObjectPicker);
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <aclui.h>
|
||||
#include <cguid.h>
|
||||
#include <objbase.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "hexedit.h"
|
||||
|
@ -190,7 +189,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
{
|
||||
MSG msg;
|
||||
HACCEL hAccel;
|
||||
HRESULT hComInit;
|
||||
|
||||
/*
|
||||
int hCrt;
|
||||
FILE *hf;
|
||||
|
@ -223,9 +222,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
return FALSE;
|
||||
}
|
||||
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);
|
||||
|
||||
/* initialize the COM library for the remote registry object picker dialog */
|
||||
hComInit = CoInitialize(NULL);
|
||||
|
||||
/* Main message loop */
|
||||
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
|
||||
|
@ -236,11 +232,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hComInit))
|
||||
{
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
ExitInstance(hInstance);
|
||||
return msg.wParam;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue