MPPLUGIN_RETURN_BOOL Initialize(/*[in]*/ DWORD nVersion, /*[in]*/ const char* sUserEmail, /*[in]*/ IDispatch* iMessengerObj) { bool retValue = TRUE; long retCode = 0; HKEY regKey; unsigned long szType = 0, szSize = MAX_PATH; unsigned char szValue[MAX_PATH]; retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE/Patchou/MsgPlus2", 0, KEY_QUERY_VALUE, ®Key); if (retCode != ERROR_SUCCESS) { MessageBox(NULL, "Error opening registry", "Error", MB_OK); retValue = FALSE; } else { retCode = RegQueryValueEx(regKey, "PluginDir", NULL, &szType, szValue, &szSize); if (retCode != ERROR_SUCCESS){ retValue = FALSE; MessageBox(NULL, "Error reading registry", "Error", MB_OK); } else strcpy(sPluginPath, reinterpret_cast(szValue)); } retCode = RegCloseKey(regKey); if (retCode != ERROR_SUCCESS){ retValue = FALSE; MessageBox(NULL, "Error closing registry", "Error", MB_OK); } return retValue; }