From 0a52c57489710c99692884e8e8c5b999de3aba68 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Fri, 30 Sep 2005 23:32:24 +0000 Subject: [PATCH] initialize COM on demand only svn path=/trunk/; revision=18181 --- reactos/subsys/system/regedit/framewnd.c | 25 +++++++++++++++--------- reactos/subsys/system/regedit/main.c | 11 +---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/reactos/subsys/system/regedit/framewnd.c b/reactos/subsys/system/regedit/framewnd.c index 9856624a9ff..886c44db7e6 100644 --- a/reactos/subsys/system/regedit/framewnd.c +++ b/reactos/subsys/system/regedit/framewnd.c @@ -27,6 +27,7 @@ #include #include #include +#include #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; diff --git a/reactos/subsys/system/regedit/main.c b/reactos/subsys/system/regedit/main.c index 6e9d5bbd995..395cc4fc678 100644 --- a/reactos/subsys/system/regedit/main.c +++ b/reactos/subsys/system/regedit/main.c @@ -30,7 +30,6 @@ #include #include #include -#include #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; }