Example #1
0
//loads all the severity options from the registry (for color and things like that)
void CBackEndDialog::LoadSevOptionsFromReg()
{
	for(uint32 nCurrSev = 0; nCurrSev < NUM_SEVERITIES; nCurrSev++)
	{
		CString sKey = BuildSevKeyName(nCurrSev);

		m_SevColor[nCurrSev]	= atoi(GetRegistryKey(HKEY_CURRENT_USER, sKey + "Color", "0"));
		m_sSevPrefix[nCurrSev]	= GetRegistryKey(HKEY_CURRENT_USER, sKey + "Prefix", "");
	}
}
BOOL	CRegistry::WriteProfileString( LPCSTR lpszSection, LPCSTR lpszEntry, LPCSTR lpszValue )
{
#ifndef	INI_USE
	LONG	lResult;
	if( !lpszEntry ) {
		HKEY	hAppKey = GetRegistryKey();
		if( !hAppKey )
			return	FALSE;
		lResult = ::RegDeleteKey( hAppKey, lpszSection );
		::RegCloseKey( hAppKey );
	} else if( !lpszValue ) {
		HKEY	hSecKey = GetSectionKey( lpszSection );
		if( !hSecKey )
			return	FALSE;
		lResult = ::RegDeleteValue( hSecKey, (LPTSTR)lpszEntry );
		::RegCloseKey( hSecKey );
	} else {
		HKEY	hSecKey = GetSectionKey( lpszSection );
		if( !hSecKey )
			return	FALSE;
		lResult = ::RegSetValueEx(hSecKey, lpszEntry, NULL, REG_SZ,
			(LPBYTE)lpszValue, (lstrlen(lpszValue)+1)*sizeof(TCHAR));
		::RegCloseKey( hSecKey );
	}
	return	(lResult == ERROR_SUCCESS);
#else
	return	::WritePrivateProfileString( lpszSection, lpszEntry, lpszValue, m_szRegistryKey );
#endif
}
Example #3
0
static void setup_ivl_environment()
{
	if (*gstr.pIVL) {
		checkIvlDir(gstr.pIVL);
		SetRegistryKey(IVL_REGKEY_IVL,gstr.pIVL);
	} else if (!GetRegistryKey(IVL_REGKEY_IVL,&gstr.pIVL)) {
			fprintf(stderr,"error: can not locate the Icarus Verilog root directory, use the -ivl option\n");
			fprintf(stderr,"       of iverilog-vpi" IVERILOG_SUFFIX " to point to the Icarus Verilog root directory.\n");
			fprintf(stderr,"       For a Windows command shell the option would be something like\n");
			fprintf(stderr,"       -ivl=c:\\iverilog  For a Cygwin shell the option would be something\n");
			fprintf(stderr,"       like -ivl=c:\\\\iverilog\n");
			myExit(6);
		}

	  /* Build up the CFLAGS option string */
	assign(&gstr.pCFLAGS,IVERILOG_VPI_CFLAGS " -I\"");
	append(&gstr.pCFLAGS,gstr.pIVL);
	appendBackSlash(&gstr.pCFLAGS);
	append(&gstr.pCFLAGS,"\\include\\\\iverilog\"" IVERILOG_SUFFIX);

	  /* Build up the LDFLAGS option string */
	assign(&gstr.pLDLIBS,"-L\"");
	append(&gstr.pLDLIBS,gstr.pIVL);
	appendBackSlash(&gstr.pLDLIBS);
	append(&gstr.pLDLIBS,"\\lib\" " IVERILOG_VPI_LDLIBS);
}
Example #4
0
static void setup_mingw_environment()
{
	char *pOldPATH = getenv("PATH");		/* get current path */

	if (*gstr.pMINGW) {
		checkMingwDir(gstr.pMINGW);
		SetRegistryKey(IVL_REGKEY_MINGW,gstr.pMINGW);
	} else if (!GetRegistryKey(IVL_REGKEY_MINGW,&gstr.pMINGW)) {
			fprintf(stderr,"error: can not locate the MinGW root directory, use the -mingw option of\n");
			fprintf(stderr,"       iverilog-vpi.exe to point to the MinGW root directory.  For\n");
			fprintf(stderr,"       a Windows command shell the option would be something like\n");
			fprintf(stderr,"       -mingw=c:\\mingw  For a Cygwin shell the option would be\n");
			fprintf(stderr,"       something like -mingw=c:\\\\mingw\n");
			myExit(5);
		}

	  /* Create new path with MinGW in it */
	assign(&gstr.pNewPath,"PATH=");
	append(&gstr.pNewPath,gstr.pMINGW);
	appendBackSlash(&gstr.pNewPath);
	append(&gstr.pNewPath, "\\");
	append(&gstr.pNewPath,"bin;");
	append(&gstr.pNewPath,pOldPATH);

	  /* Place new path in environment */
	_putenv(gstr.pNewPath);
}
Example #5
0
int main() {
	char buffer[10000];
	int ret;
	GetRegistryKey("Environment", "TEMP", buffer);
	printf ( "TEMP: %s\n", buffer );
	strcpy(buffer, "D:\\Temp");
	ret = SetRegistryKey("Environment", "TEMP", buffer);
	printf ( "RET: %d\n", ret );

	GetRegistryKey("Keyboard Layout\\Preload", "1", buffer);
	printf ( "Keyboard Layout: %s\n", buffer );
	strcpy(buffer, "00000409");                 /* minus 1 */
	ret = SetRegistryKey("Keyboard Layout\\Preload", "1", buffer);
	printf ( "RET: %d\n", ret );

	return 0;
}
Example #6
0
HKEY GetModuleKey(const char *proc_name)
{
	HKEY hModule = NULL;

	// Work out the registry key to save this under
	sModulePrefs = (char *) malloc(strlen(sPrefSegment) + strlen(proc_name) + 1);
	if (sModulePrefs == NULL)
		return FALSE;
	sprintf(sModulePrefs, "%s%s", sPrefSegment, proc_name);

	// Check whether the library's entry exists!
	HKEY hAppKey = GetRegistryKey();
	if (hAppKey == NULL)
		return NULL;

	// Attempt to open the section for this application
	if (RegOpenKeyEx(hAppKey,
					sModulePrefs,
					0, KEY_WRITE|KEY_READ,
					&hModule
					) != ERROR_SUCCESS)
	{
		// Cut off the app directory and just use the name
		char *file_name = NameFromPath(proc_name);

		if (file_name == NULL)
		{
			RegCloseKey(hAppKey);
			return NULL;
		}

		// Adjust the moduleprefs name
		sprintf(sModulePrefs, "%s%s", sPrefSegment, file_name);
		free(file_name);

		// Now get the module key again
		DWORD dw;
		if (RegCreateKeyEx(hAppKey,
					sModulePrefs,
					0, REG_NONE, REG_OPTION_NON_VOLATILE,
					KEY_WRITE|KEY_READ,
					NULL,
					&hModule,
					&dw) != ERROR_SUCCESS)
		{
			// Couldn't find/create the key - fail!
			RegCloseKey(hAppKey);
			return NULL;
		}
	}

	// Close the application registry key
	RegCloseKey(hAppKey);

	return hModule;
}
Example #7
0
// Gets the value in a registry key, or returns the default if it cannot be found
// The current key must be one of the HKEY_CLASSES_ROOT, etc. For the path, it should
// be like "dir\dir\keyname"
CString GetRegistryKey(HKEY hCurrentKey, const char* pszKeyPath, const char* pszDefault)
{
	CString sPath(pszKeyPath);

	int nSlashPos = sPath.FindOneOf("\\/");

	if(nSlashPos == -1)
	{
		//we hit the end, we need to try and read the value
		LONG nSize;
		if(RegQueryValue(hCurrentKey, sPath, NULL, &nSize) == ERROR_SUCCESS)
		{
			//create a buffer
			char* pszBuffer = new char [nSize + 1];

			LONG nNewSize = nSize + 1;
			RegQueryValue(hCurrentKey, sPath, pszBuffer, &nNewSize);

			//make sure to end it
			pszBuffer[nSize] = '\0';

			CString sRV(pszBuffer);
			delete [] pszBuffer;

			return sRV;
		}
		else
		{
			return CString(pszDefault);
		}
	}
	else
	{
		CString sCurrDir = sPath.Left(nSlashPos);
		
		//trim off the path
		sPath = sPath.Mid(nSlashPos + 1);

		//we need to recurse
		HKEY hNewKey;
		if(RegOpenKey(hCurrentKey, sCurrDir, &hNewKey) == ERROR_SUCCESS)
		{
			CString sRV = GetRegistryKey(hNewKey, sPath, pszDefault);
			RegCloseKey(hNewKey);
			return sRV;
		}
		else
		{
			//not there
			return CString(pszDefault);
		}
	}
}
HKEY	CRegistry::GetSectionKey( LPCTSTR lpszSection )
{
	HKEY	hAppKey = GetRegistryKey();
	if( !hAppKey )
		return	NULL;
	HKEY	hSectionKey = NULL;
	DWORD	dw;
	::RegCreateKeyEx( hAppKey, lpszSection, 0, REG_NONE,
		REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL, &hSectionKey, &dw );
	::RegCloseKey( hAppKey );

	return	hSectionKey;
}
NS_IMETHODIMP nsDeviceSupport::IsDefaultBrowser(PRBool *_retval)
{
  *_retval = PR_FALSE;

#ifdef XP_WIN

  char buffer[MAX_PATH];
  GetRegistryKey(HKEY_CLASSES_ROOT, "http\\Shell\\Open\\Command", (char*)&buffer);

  if (strstr( buffer, "minimo_runner"))
    *_retval = PR_TRUE;
  
#endif
  return NS_OK;
}
Example #10
0
UnicodeString TConfiguration::GetRegistryStorageKey() const
{
  return GetRegistryKey();
}
Example #11
0
//---------------------------------------------------------------------------
UnicodeString __fastcall TConfiguration::GetRegistryStorageKey()
{
  return GetRegistryKey();
}
Example #12
0
BOOL CBackEndDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//setup the icon for this window
	SetIcon(m_hMainIcon, TRUE);			// Set big icon
	SetIcon(m_hMainIcon, FALSE);		// Set small icon

	//make it so that the OK button is hidden, it will be revealed again once the processing
	//is done
	((CButton*)GetDlgItem(IDOK))->ModifyStyle(WS_VISIBLE, 0);

	//set up the save button to be invisible and have the disk icon
	((CButton*)(GetDlgItem(IDC_BUTTON_SAVE_LOG)))->SetIcon(m_hSaveIcon);
	((CButton*)GetDlgItem(IDC_BUTTON_SAVE_LOG))->ModifyStyle(WS_VISIBLE, 0);

	((CButton*)(GetDlgItem(IDC_BUTTON_MESSAGE_OPTIONS)))->SetIcon(m_hOptionsIcon);

	//setup the progress bar
	CProgressCtrl* pProgress = ((CProgressCtrl*)GetDlgItem(IDC_PROGRESS_TASK));
	pProgress->SetRange(0, 1000);

	//the base registry location
	CString sRegBase = PACKER_REGISTRY_DIRECTORY;

	//set the thread priority to normal
	uint32 nThreadPri = atoi(GetRegistryKey(HKEY_CURRENT_USER, sRegBase + "ThreadPri", "2"));
	((CComboBox*)GetDlgItem(IDC_COMBO_THREAD_PRIORITY))->SetCurSel(nThreadPri);

	//set the message filter to show everything
	uint32 nFilter = atoi(GetRegistryKey(HKEY_CURRENT_USER, sRegBase + "Filter", "5"));
	((CComboBox*)GetDlgItem(IDC_COMBO_MESSAGE_FILTER))->SetCurSel(nFilter);
	OnChangeMessageFilter();

	//create the thread data
	g_ThreadData.m_sFilename		= m_sFilename;
	g_ThreadData.m_pIPackerImpl		= m_pIPackerImpl;
	g_ThreadData.m_pIPackerOutput	= (IPackerOutput*)this;
	g_ThreadData.m_pPropList		= m_pPropList;

	//load the options for the severities
	LoadSevOptionsFromReg();

	//setup the tooltips
	m_ToolTip.Create(this);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_BUTTON_SAVE_LOG), IDS_TOOLTIP_SAVE_LOG);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_COMBO_THREAD_PRIORITY), IDS_TOOLTIP_THREAD_PRIORITY);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_COMBO_MESSAGE_FILTER), IDS_TOOLTIP_MESSAGE_FILTER);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_PROGRESS_TASK), IDS_TOOLTIP_TASK_PROGRESS);
	m_ToolTip.AddWindowTool(GetTaskList(), IDS_TOOLTIP_TASK_LIST);
	m_ToolTip.AddWindowTool(GetMessageList(), IDS_TOOLTIP_MESSAGE_LIST);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_BUTTON_MESSAGE_OPTIONS), IDS_TOOLTIP_MESSAGE_OPTIONS);

	//now we need to launch the background thread which will spawn the packer to do its
	//thing
	DWORD nThreadID;
	m_hThread = CreateThread(NULL, 0, LaunchPackerThreadMain, NULL, 0, &nThreadID); 
	
	//now that the thread is created, we need to ensure that the proper priority is set
	//on it
	OnThreadPriorityChanged();
	
	SetTimer(TIMER_EVENT_ID, 50, NULL);	
	
	return TRUE;  
}
Example #13
0
NTSTATUS
  CyEvtDevicePrepareHardware (
    IN WDFDEVICE  Device,
    IN WDFCMRESLIST  ResourcesRaw,
    IN WDFCMRESLIST  ResourcesTranslated
    )
{
	NTSTATUS  NTStatus;
	PDEVICE_CONTEXT  pDeviceContext;
	WDF_USB_DEVICE_INFORMATION UsbDeviceInfo;
    ULONG ulWaitWakeEnable;

	UNICODE_STRING unicodeSCRIPTFILE;	
	WDF_OBJECT_ATTRIBUTES  attributes;
	WDFMEMORY  hScriptFileNameBufMem;
	PVOID  pScriptFNBuf=NULL;
	ULONG ScripFileNtBufferlen=0;

	UNREFERENCED_PARAMETER(ResourcesRaw);
    UNREFERENCED_PARAMETER(ResourcesTranslated);
    ulWaitWakeEnable = FALSE;

    PAGED_CODE();

    CyTraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "Start CyEvtDevicePrepareHardware\n");

    pDeviceContext = CyGetDeviceContext(Device);

	//
    // Create a USB device handle so that we can communicate with the
    // underlying USB stack. The WDFUSBDEVICE handle is used to query,
    // configure, and manage all aspects of the USB device.
    // These aspects include device properties, bus properties,
    // and I/O creation and synchronization. We only create device the first
    // the PrepareHardware is called. If the device is restarted by pnp manager
    // for resource rebalance, we will use the same device handle but then select
    // the interfaces again because the USB stack could reconfigure the device on
    // restart.
    //	
    if (pDeviceContext->CyUsbDevice == NULL)
	{
        NTStatus = WdfUsbTargetDeviceCreate(Device,
                                    WDF_NO_OBJECT_ATTRIBUTES,
                                    &pDeviceContext->CyUsbDevice);
        if (!NT_SUCCESS(NTStatus)) {
            CyTraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                 "WdfUsbTargetDeviceCreate failed with Status code %!STATUS!\n", NTStatus);
            return NTStatus;
        }
    }    

	 //
    // Retrieve USBD version information, port driver capabilites and device
    // capabilites such as speed, power, etc.
    //
    WDF_USB_DEVICE_INFORMATION_INIT(&UsbDeviceInfo);

    NTStatus = WdfUsbTargetDeviceRetrieveInformation(
                                pDeviceContext->CyUsbDevice,
                                &UsbDeviceInfo);
    if (NT_SUCCESS(NTStatus))
	{
        CyTraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "IsDeviceHighSpeed: %s\n",
            (UsbDeviceInfo.Traits & WDF_USB_DEVICE_TRAIT_AT_HIGH_SPEED) ? "TRUE" : "FALSE");
        CyTraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                    "IsDeviceSelfPowered: %s\n",
            (UsbDeviceInfo.Traits & WDF_USB_DEVICE_TRAIT_SELF_POWERED) ? "TRUE" : "FALSE");

        ulWaitWakeEnable = UsbDeviceInfo.Traits &
                            WDF_USB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE;

        CyTraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                            "IsDeviceRemoteWakeable: %s\n",
                            ulWaitWakeEnable ? "TRUE" : "FALSE");
        
        pDeviceContext->ulUSBDeviceTrait = UsbDeviceInfo.Traits;
		pDeviceContext->ulUSBDIVersion = UsbDeviceInfo.UsbdVersionInformation.USBDI_Version;
		pDeviceContext->ulWaitWakeEnable = ulWaitWakeEnable;
    }   
	
	//Get device descriptor
	WdfUsbTargetDeviceGetDeviceDescriptor(
									  pDeviceContext->CyUsbDevice,
									  &pDeviceContext->UsbDeviceDescriptor
									  );
	
    NTStatus = CySelectInterfaces(Device);

    if (!NT_SUCCESS(NTStatus))
	{
        CyTraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                    "SelectInterfaces failed 0x%x\n", NTStatus);

        return NTStatus;
    }
   
	if (ulWaitWakeEnable)
	{
        NTStatus = CySetPowerPolicy(Device);
        if (!NT_SUCCESS (NTStatus)) 
		{
            CyTraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                                "Set power policy failed  %!STATUS!\n", NTStatus);
            return NTStatus;
        }
    }
	// Check for the script file in the registry and execute if it is exist
	
	// Allocate buffer to get the registry key
	WDF_OBJECT_ATTRIBUTES_INIT(&attributes);	
	NTStatus = WdfMemoryCreate(
							 &attributes,
							 NonPagedPool,
							 0,
							 CYREGSCRIPT_BUFFER_SIZE,
							 &hScriptFileNameBufMem,
							 &pScriptFNBuf
							 );
	if (!NT_SUCCESS(NTStatus)) {
		CyTraceEvents(TRACE_LEVEL_ERROR, DBG_PNP, "WdfMemoryCreate failed  %!STATUS!\n",NTStatus);        
		return FALSE;
	}

	
    if(GetRegistryKey(Device, NULL, REG_SZ, CYREG_SCRIPTFILE, pScriptFNBuf,&ScripFileNtBufferlen)) 
    {	
        CyExecuteScriptFile(Device, pScriptFNBuf);
    }
	CyTraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "End CyEvtDevicePrepareHardware\n");		
        
	////
	CyTraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "End CyEvtDevicePrepareHardware\n");	
	return NTStatus;
}
	/** Install and Uninstall the service and write actions to the event
	log. If pszFullPath is given, it will be set as the path, otherwise the
	path will be retreived from the module name. The default command line
	processing calls this function with pszLogonAs and pszLogonPassword set
	to NULL. Override this function, and when bInstall is VTRUE, get the
	logon as and password if needed, and then call the base class function.
	pszLogonAs can be either a DomainName\UserName or just the UserName, in
	which case this function will prepend .\ which is required by the
	CreateService() API function. Returns VTRUE on success, VFALSE on
	failure.*/
	virtual VBOOL			Install(	VBOOL			bInstall =
															VTRUE,
										VDWORD			nStartType =
															SERVICE_AUTO_START,
										VSTRING_CONST	pszFullPath =
															NULL,
										VSTRING_CONST	pszLogonAs =
															NULL,
										VSTRING_CONST	pszLogonPassword =
															NULL,
										VBOOL			bStartAfterInstall =
															VTRUE,
										VBOOL			bSilentMode =
															VFALSE)
	{
		/* Service name should not be empty!*/
		VASSERT(m_strServiceName.IsNotEmpty())

		/* Assume failure.*/
		VBOOL bSuccess = VFALSE;

		/* Open the Service Control Manager.*/
		SC_HANDLE hSCM =
			OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);

		if ( hSCM )
		{
			if ( bInstall )
			{
				/* Verify un-installed, first (silent mode).*/
				Install(VFALSE, 0, NULL, NULL, NULL, VFALSE, VTRUE);

				/* Get this executables file path (unless given
				in pszFullPath).*/
				VString sPath;

				if ( !pszFullPath )
					sPath.GetModulePath(VFALSE, VFALSE);
				else
					sPath = pszFullPath;

				if ( sPath.IsNotEmpty() )
				{
					/* If pszLogonAs is not NULL, verify domain name is
					present, and if not, .\ is present. If neither is the
					case, we will modify the logon as to be correct.*/
					VString strLogonAs;

					if ( pszLogonAs )
					{
						/* If we find a \ assume correct DomainName\UserName
						string.*/
						if ( !VSTRCHR(pszLogonAs, VTEXT('\\')) )
						{
							/* Domain Name not given, so does the
							string already contain .\ sequence as the
							first chars?*/
							if (	!(*pszLogonAs == VTEXT('.') &&
									*(pszLogonAs + 1) == VTEXT('\\')) )
							{
								strLogonAs = VTEXT(".\\");
								strLogonAs += pszLogonAs;
								pszLogonAs = strLogonAs;
							}
						}
					}

					/* We want no error condition now.*/
					SetLastError(0);

					/* Create the service.*/
					SC_HANDLE hService =
						CreateService(	hSCM,
										m_strServiceName,
										m_strServiceName,
										SERVICE_ALL_ACCESS,
										m_Status.dwServiceType,
										nStartType,
										SERVICE_ERROR_NORMAL,
										sPath,
										NULL,
										NULL,
										NULL,
										pszLogonAs,
										pszLogonPassword);

					if (	hService ||
							GetLastError() == ERROR_SERVICE_EXISTS )
					{
						/* Make or verify registry entries to
						support event logging.*/
						bSuccess =
							(m_hEventSource)
							? VTRUE
							: Register(m_strServiceName);

						if (	hService &&
								bSuccess &&
								bStartAfterInstall )
						{
							bSuccess =
								StartService(hService, 0, NULL);

							/* If service fails to start now, un-install it.*/
							if ( !bSuccess )
							{
								/* Close handle first.*/
								CloseServiceHandle(hService);
								hService = NULL;

								/* Un-Install in silent mode.*/
								Install(	VFALSE,
											0,
											NULL,
											NULL,
											NULL,
											VFALSE,
											VTRUE);
							}
						}

						if ( hService )
							CloseServiceHandle(hService);
					}
				}

				/* Log what happened if we can.*/
				LogEvent(	(bSuccess)
							? EM_SERVICE_INSTALLED
							: EM_SERVICE_NOT_INSTALLED,
							(bSuccess)
							? VFALSE
							: VTRUE);

				/* Notify via virtual function.*/
				OnInstall(bSuccess, bSilentMode);
			}
			else
			{
				SC_HANDLE hService =
					OpenService(	hSCM,
									m_strServiceName,
									SERVICE_QUERY_STATUS | DELETE);

				if ( hService )
				{
					/* If the service is running, stop it.*/
					SERVICE_STATUS ss;

					if ( QueryServiceStatus(hService, &ss) )
					{
						if ( ss.dwCurrentState != SERVICE_STOPPED )
						{
							/* Get a handle we can use to
							stop the service.*/
							SC_HANDLE hStopService =
								OpenService(	hSCM,
												m_strServiceName,
												SERVICE_STOP);

							if ( hStopService )
							{
								SERVICE_STATUS ss;
								ControlService(	hStopService,
												SERVICE_CONTROL_STOP, &ss);

								CloseServiceHandle(hStopService);
							}
						}
					}

					bSuccess =
						(hService && DeleteService(hService))
						? VTRUE
						: VFALSE;

					CloseServiceHandle(hService);
				}
				else
					bSuccess = VTRUE;

				/* Remove registry entries on success.*/
				if ( bSuccess )
				{
					VRegistry reg;

					if ( reg.CreateKey(GetRegistryKey(), HKEY_LOCAL_MACHINE) )
						reg.DeleteSubKeyNT(m_strServiceName);
				}

				/* Log what happened if we can.*/
				LogEvent(	(bSuccess)
							? EM_SERVICE_UNINSTALLED
							: EM_SERVICE_NOT_REMOVED,
							(bSuccess)
							? VFALSE
							: VTRUE);

				/* Notify via virtual function.*/
				OnUnInstall(bSuccess, bSilentMode);
			}

			CloseServiceHandle(hSCM);
		}

		return bSuccess;
	}