DWORD dwResult = ::GetModuleFileName(theApp.m_hInstance, szModuleFileName, MAX_PATH); if (dwResult == 0) return E_FAIL;
if (!GetModuleFileName(m_hInstance, szModuleFileName, MAX_PATH)) return E_FAIL;
DllRegisterServer (void){        HKEY hkey;    CHAR szKeyBuf[1024];    CHAR szEntry[512];    TCHAR szModuleFileName[MAX_PATH];    DWORD dwTemp = 0;    long ec;    /* get server location */    DWORD dwResult = ::GetModuleFileName(theApp.m_hInstance, szModuleFileName, MAX_PATH);    if (dwResult == 0)		return E_FAIL;    lstrcpy (szKeyBuf, "Software\\Microsoft\\Exchange\\Client\\Extensions");    lstrcpy (szEntry, "4.0;");    lstrcat (szEntry, szModuleFileName);    lstrcat (szEntry, ";1;11000111111100");  /* context information */    ec = RegCreateKeyEx (HKEY_LOCAL_MACHINE, szKeyBuf, 0, NULL, 				   REG_OPTION_NON_VOLATILE,				   KEY_ALL_ACCESS, NULL, &hkey, NULL);    if (ec != ERROR_SUCCESS) {	ExchLogInfo ("DllRegisterServer failed\n");	return E_ACCESSDENIED;    }        dwTemp = lstrlen (szEntry) + 1;    RegSetValueEx (hkey, "OutlGPG", 0, REG_SZ, (BYTE*) szEntry, dwTemp);    /* set outlook update flag */    strcpy (szEntry, "4.0;Outxxx.dll;7;000000000000000;0000000000;OutXXX");    dwTemp = lstrlen (szEntry) + 1;    RegSetValueEx (hkey, "Outlook Setup Extension", 0, REG_SZ, (BYTE*) szEntry, dwTemp);    RegCloseKey (hkey);        hkey = NULL;    lstrcpy (szKeyBuf, "Software\\GNU\\OutlGPG");    RegCreateKeyEx (HKEY_CURRENT_USER, szKeyBuf, 0, NULL,		    REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL);    if (hkey != NULL)	RegCloseKey (hkey);    ExchLogInfo ("DllRegisterServer succeeded\n");    return S_OK;}