当前位置: 首页>>代码示例>>C++>>正文


C++ RegDeleteValue函数代码示例

本文整理汇总了C++中RegDeleteValue函数的典型用法代码示例。如果您正苦于以下问题:C++ RegDeleteValue函数的具体用法?C++ RegDeleteValue怎么用?C++ RegDeleteValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RegDeleteValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Uninstall_Init

/**
 * Handles tasks done at beginning of uninstallation
 */
codeUNINSTALL_INIT Uninstall_Init(
  HWND hwndparent,LPCTSTR pszinstalldir)
{
  HKEY hKey = NULL;

  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE ,
      TEXT("\\Software\\Microsoft\\Today\\Items\\XCSoar"),
      0, KEY_ALL_ACCESS, &hKey
    ) == ERROR_SUCCESS){

    DebugMessage("Setup", "Delete Value DLL");

    RegDeleteValue(hKey, TEXT("DLL"));

    RegCloseKey(hKey);

    DebugMessage("Setup", "Refresh Today");

    SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);

  }

  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE ,
      TEXT("\\Software\\Microsoft\\Today\\Items"),
      0, KEY_ALL_ACCESS, &hKey
    ) == ERROR_SUCCESS){

    DebugMessage("Setup", "Delete Key \\...Today\\XCSoar");

    RegDeleteKey(hKey, TEXT("XCSoar"));

    RegCloseKey(hKey);

  }

  return codeUNINSTALL_INIT_CONTINUE;
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:40,代码来源:XCSoarSetup.cpp

示例2: request_registry_delete_value

/*
 * Deletes a registry value from the supplied registry key
 *
 * TLVs:
 *
 * req: TLV_TYPE_HKEY       - The HKEY from which to delete the value
 * req: TLV_TYPE_VALUE_NAME = The name of the value to delete
 */
DWORD request_registry_delete_value(Remote *remote, Packet *packet)
{
	Packet *response = packet_create_response(packet);
	LPCSTR valueName = NULL;
	DWORD result = ERROR_SUCCESS;
	HKEY hkey = NULL;

	hkey      = (HKEY)packet_get_tlv_value_uint(packet, TLV_TYPE_HKEY);
	valueName = (LPCSTR)packet_get_tlv_value_string(packet, TLV_TYPE_VALUE_NAME);

	// Check for invalid parameters
	if ((!hkey) || 
	    (!valueName))
		result = ERROR_INVALID_PARAMETER;
	else
		result = RegDeleteValue(hkey, valueName);

	// Set the result and send the response
	packet_add_tlv_uint(response, TLV_TYPE_RESULT, result);

	packet_transmit(remote, response, NULL);

	return ERROR_SUCCESS;
}
开发者ID:lizard007,项目名称:msf3,代码行数:32,代码来源:registry.c

示例3: DeleteSubKey

    bool DeleteSubKey(
#ifdef FAR3
                KEY_TYPE root)
    {
	FarSettingsValue value = {sizeof value, root, NULL};
	return SettingsControl(handle,SCTL_DELETE,0,&value) != 0;
#else
                PCWSTR szName, KEY_TYPE root = 0)
    {
        if(root == 0) root = hKey;
        return RegDeleteKeyW(root, szName) == ERROR_SUCCESS;
#endif
    }

    bool DeleteValue(PCTSTR szName, KEY_TYPE root = 0)
    {
#ifdef FAR3
	FarSettingsValue value = {sizeof value, root, szName};
	return SettingsControl(handle,SCTL_DELETE,0,&value) != 0;
#else
        if(root == 0) root = hKey;
        return RegDeleteValue(root, szName) == ERROR_SUCCESS;
#endif
    }
开发者ID:yutsis,项目名称:YMSPlugins,代码行数:24,代码来源:PluginSettings.hpp

示例4: winregdeletevalue

static boolean winregdeletevalue (HKEY hkey, Handle h, bigstring bsitem) {

	/*
	7.0.2b1 Radio PBS: delete a value.
	*/

	long lentext;
	char item [256];
	char * itemptr;
	boolean fl = true;

	lentext = gethandlesize (h);

	sethandlesize (h, lentext + 1);

	(*h) [lentext] = '\0'; /*null terminate*/

	copyptocstring (bsitem, item);

	itemptr = item;

	lockhandle (h);

	if (RegOpenKeyEx (hkey, *h, 0, KEY_SET_VALUE, &hkey) == ERROR_SUCCESS) {

		if (RegDeleteValue (hkey, itemptr) == ERROR_SUCCESS)

			fl = true;

		RegCloseKey (hkey);
		} /*if*/

	unlockhandle (h);

	return (fl);
	} /*winregdeletevalue*/
开发者ID:dvincent,项目名称:frontier,代码行数:36,代码来源:winregistry.c

示例5: WriteReg

/** write a to registry (at User)
params - none
*/
void WriteReg(HKEY key, LPCTSTR path, LPCTSTR val_name, LPBYTE value, DWORD len) 
{	
	HKEY hKey;
	LONG ret;
		
	if( ret=RegOpenKeyEx(key, path, 0, KEY_ALL_ACCESS | KEY_WOW64_32KEY, &hKey) ) {
		//if (ret==5)		
			if( ret=RegOpenKeyEx(key, path, 0, KEY_ALL_ACCESS , &hKey) )
				if ( ret=RegCreateKeyEx(key, path, 0, NULL, 0, KEY_WOW64_32KEY | KEY_ALL_ACCESS, NULL, &hKey, NULL) )	
					RegCreateKeyEx(key, path, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL);
	}

	if (value==NULL) 
		ret = RegDeleteValue(hKey, val_name);
	else {		
		ret = RegSetValueEx(hKey, val_name, 0, REG_BINARY, value, len);
		if ( ERROR_SUCCESS != ret)
			WriteLog( TEXT("WriteReg failed %X %s %s"), ret, path, val_name);
	}

	RegCloseKey(hKey);

	return ;
}
开发者ID:TeslineServices,项目名称:RohosDiskBrowser,代码行数:27,代码来源:common1.cpp

示例6: RegisterPreLoad

void RegisterPreLoad(bool bRegister)
{
	const std_string strPath = GetKeePassExePath();
	if(strPath.size() == 0) return;

	HKEY hKey = NULL;
	if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
		0, KEY_WRITE, &hKey) != ERROR_SUCCESS) return;
	if(hKey == NULL) return;

	const std_string strItemName = _T("KeePass 2 PreLoad");
	std_string strItemValue = _T("\"");
	strItemValue += strPath;
	strItemValue += _T("\" --preload");

	if(bRegister)
		RegSetValueEx(hKey, strItemName.c_str(), 0, REG_SZ,
			(const BYTE*)strItemValue.c_str(), static_cast<DWORD>((strItemValue.size() +
			1) * sizeof(TCHAR)));
	else
		RegDeleteValue(hKey, strItemName.c_str());

	RegCloseKey(hKey);
}
开发者ID:amiryal,项目名称:keepass2,代码行数:24,代码来源:ShInstUtil.cpp

示例7: SetRegRun

void SetRegRun(bool isSet, LPCWSTR path)
{
	HKEY hkey;
	LPCWSTR keyName = L"SecMon";

	LONG reg = RegOpenKeyEx(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0L, KEY_ALL_ACCESS, &hkey);
	if (ERROR_SUCCESS == reg) {

		if (isSet) {
			WCHAR getValue[MAX_PATH] = L"";
			DWORD dwType, dwBytes = MAX_PATH;
			reg = RegQueryValueEx(hkey, keyName, 0, &dwType, (BYTE*)getValue, &dwBytes);

			if (reg != ERROR_SUCCESS || 1 > wcslen(getValue)) {
				reg = RegSetValueEx(hkey, keyName, 0, REG_SZ, (BYTE*)path, MAX_PATH);
			}
		}
		else {
			RegDeleteValue(hkey, keyName);
		}

		RegCloseKey(hkey);
	}
}
开发者ID:cro1002,项目名称:secmon,代码行数:24,代码来源:starter.cpp

示例8: _T

//---------------------------------------------------------------------------
//	◎함수명 : RegDelete
//	◎함수설명 : 레지스트리의 특정 데이터를 삭제한다
//	◎인자 : CString 레지스트리경로, CString 삭제할이름
//	삭제할이름이 빈문자열이거나 "0"일 경우 해당 경로를 포함한 하위
//	서브키들까지 모조리 삭제한다.
//	◎반환값 : 성공시 TRUE, 실패시 FALSE
//---------------------------------------------------------------------------
BOOL CRegistryMgr::RegDelete(CString rpath, CString name)
{
	int strindex;
	CString temp = _T("");
	HKEY hCategoryKey;

	strindex = rpath.Find('\\');
	if(strindex<0) return FALSE;
	temp = rpath.Left(strindex);
	if(temp.CompareNoCase(_T("HKEY_CLASSES_ROOT"))==0) hCategoryKey = HKEY_CLASSES_ROOT;
	else if(temp.CompareNoCase(_T("HKEY_CURRENT_CONFIG"))==0) hCategoryKey = HKEY_CURRENT_CONFIG;
	else if(temp.CompareNoCase(_T("HKEY_CURRENT_USER"))==0) hCategoryKey = HKEY_CURRENT_USER;
	else if(temp.CompareNoCase(_T("HKEY_LOCAL_MACHINE"))==0) hCategoryKey = HKEY_LOCAL_MACHINE;
	else if(temp.CompareNoCase(_T("HKEY_USERS"))==0) hCategoryKey = HKEY_USERS;
	else return FALSE;

	
	rpath = rpath.Mid(strindex+1);
	long lRet;
	if(name.IsEmpty() || name.Compare(_T("0"))==0){		// 하위 경로까지 몽땅 지우기
		lRet = RegDeleteRecursive(hCategoryKey, rpath);
		if(lRet != ERROR_SUCCESS) return FALSE;
	}
	else{											// 특정키만 지우기
		HKEY hKey;
		lRet = RegOpenKeyEx(hCategoryKey, rpath, 0, KEY_ALL_ACCESS, &hKey);
		if(lRet == ERROR_SUCCESS) // 오픈 성공하면...
		{
			lRet = RegDeleteValue(hKey, name);
			if(lRet != ERROR_SUCCESS) return FALSE;
		}
		else return FALSE;
	}

	return TRUE;
}
开发者ID:CodeGenerater,项目名称:araltrans02,代码行数:44,代码来源:cRegistryMgr.cpp

示例9: WinMain

int APIENTRY WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/,
                     int /*nCmdShow*/)
{
    HKEY hKey = NULL;
    LONG lResult;

    lResult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\SIL\\Installer\\ProductKeys", NULL,
                           KEY_WRITE, &hKey);

    if (lResult == ERROR_SUCCESS)
    {
        lResult = RegDeleteValue(hKey, "Last");
        RegCloseKey(hKey);
        hKey = NULL;

        if (lResult == ERROR_SUCCESS)
            MessageBox(NULL, "'Last' product key cleared. Try installation again.", "", 0);
        else
            MessageBox(NULL, "Error: there is no 'Last' product key.", "", 0);
        return 0;
    }
    MessageBox(NULL, "Error: cannot clear 'Last' product key.", "", 0);
    return 0;
}
开发者ID:sillsdev,项目名称:masterinstaller,代码行数:24,代码来源:ClearBadKey.cpp

示例10: swprintf_s

void CConfig::DelString(
    tLocation location,                     /**< In:    tells to use the SYSTEM or USER configuration = CConfig::SYSTEM or CConfig::USER*/
    const std::wstring &csName,             /**< In:    parameter name */
    const std::wstring &czSection           /**< In:    the configuration-section where you can find above specified parameter */
    )
{

    wchar_t     wcsKeyRegName[MAX_PATH];

    LONG    lRes;
    HKEY    hRegKeyTree;
    HKEY    hRegKey;

    if(location == SYSTEM)
        hRegKeyTree = HKEY_LOCAL_MACHINE;
    else
        hRegKeyTree = HKEY_CURRENT_USER ;


    //--- Open the KeyInfo entry
    swprintf_s(wcsKeyRegName, sizeof(wcsKeyRegName)/sizeof(wchar_t), L"%s\\%s", SC_CONF_REG, czSection.c_str());
    lRes = RegOpenKeyEx(hRegKeyTree, wcsKeyRegName, 0L, KEY_SET_VALUE, &hRegKey);
    if (lRes != ERROR_SUCCESS){
        RegCloseKey(hRegKey);
        throw CMWEXCEPTION(EIDMW_CONF);
    }

    //--- delete the value
    lRes = RegDeleteValue(hRegKey, csName.c_str());
    if (lRes != ERROR_SUCCESS){
        RegCloseKey(hRegKey);
        throw CMWEXCEPTION(EIDMW_ERR_PARAM_BAD);
    }

    RegCloseKey(hRegKey);
}
开发者ID:Blandinium,项目名称:eid-mw,代码行数:36,代码来源:configreg.cpp

示例11: SetScreenSaver

static VOID
SetScreenSaver(HWND hwndDlg, PDATA pData)
{
    HKEY regKey;
    BOOL DeleteMode = FALSE;

    DBG_UNREFERENCED_LOCAL_VARIABLE(DeleteMode);

    if (RegOpenKeyEx(HKEY_CURRENT_USER,
                     _T("Control Panel\\Desktop"),
                     0,
                     KEY_ALL_ACCESS,
                     &regKey) == ERROR_SUCCESS)
    {
        INT Time;
        BOOL bRet;
        TCHAR Sec;
        UINT Ret;

        /* Set the screensaver */
        if (pData->ScreenSaverItems[pData->Selection].bIsScreenSaver)
        {
            SIZE_T Length = _tcslen(pData->ScreenSaverItems[pData->Selection].szFilename) * sizeof(TCHAR);
            RegSetValueEx(regKey,
                          _T("SCRNSAVE.EXE"),
                          0,
                          REG_SZ,
                          (PBYTE)pData->ScreenSaverItems[pData->Selection].szFilename,
                          (DWORD)Length);

            SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_UPDATEINIFILE);
        }
        else
        {
            /* Windows deletes the value if no screensaver is set */
            RegDeleteValue(regKey, _T("SCRNSAVE.EXE"));
            DeleteMode = TRUE;

            SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, SPIF_UPDATEINIFILE);
        }

        /* Set the secure value */
        Ret = SendDlgItemMessage(hwndDlg,
                                 IDC_SCREENS_USEPASSCHK,
                                 BM_GETCHECK,
                                 0,
                                 0);
        Sec = (Ret == BST_CHECKED) ? _T('1') : _T('0');
        RegSetValueEx(regKey,
                      _T("ScreenSaverIsSecure"),
                      0,
                      REG_SZ,
                      (PBYTE)&Sec,
                      sizeof(TCHAR));

        /* Set the screensaver time delay */
        Time = GetDlgItemInt(hwndDlg,
                             IDC_SCREENS_TIMEDELAY,
                             &bRet,
                             FALSE);
        if (Time == 0)
            Time = 60;
        else
            Time *= 60;

        SystemParametersInfoW(SPI_SETSCREENSAVETIMEOUT, Time, 0, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);

        RegCloseKey(regKey);
    }
}
开发者ID:Moteesh,项目名称:reactos,代码行数:70,代码来源:screensaver.c

示例12: FillParametersKey

LONG PortParameters::Save()
{
  if (!Changed()) {
    return ERROR_SUCCESS;
  }

  char reqKey[100];

  FillParametersKey(reqKey, sizeof(reqKey)/sizeof(reqKey[0]));

  LONG err;
  HKEY hKey;

  err = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
                       reqKey,
                       0,
                       NULL,
                       0,
                       KEY_WRITE,
                       NULL,
                       &hKey,
                       NULL);

  if (err != ERROR_SUCCESS)
    return err;

  if (maskChanged & m_portName) {
    if (maskExplicit & m_portName) {
      err = RegSetValueEx(hKey,
                          "PortName",
                          NULL,
                          REG_SZ,
                          (PBYTE)portName,
                          (lstrlen(portName) + 1) * sizeof(portName[0]));
    } else {
      err = RegDeleteValue(hKey, "PortName");

      if (err == ERROR_FILE_NOT_FOUND)
        err = ERROR_SUCCESS;
    }

    if (err != ERROR_SUCCESS)
      goto err;

    maskChanged &= ~m_portName;

    //Trace("  New PortName=%s\n", portName);
  }

  int i;

  for (i = 0 ; i < sizeof(bits)/sizeof(bits[0]) ; i++) {
    if (!GetDwPtr(bits[i].bit))
      continue;

    if (SaveDw(hKey, bits[i].bit) != ERROR_SUCCESS)
      goto err;
  }

err:

  RegCloseKey(hKey);

  return err;
}
开发者ID:Asazeus,项目名称:TuneSDRcom,代码行数:65,代码来源:params.cpp

示例13: CheckReadyState

/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
void CBrowserEvents::DocumentComplete(CString & szUrl, DWORD code)
{
	CheckReadyState();
	
	// make sure we are actually measuring something
	if( active )
	{
		CheckStuff();

		EnterCriticalSection(&cs);

		// if we got an error code, use it
		if( code )
			errorCode = code;

    // update the end time
		QueryPerfCounter(lastActivity);
    end = lastActivity;
		endDoc = end;
		lastDoc = lastActivity;
		GetCPUTime(docCPU, docCPUtotal);

		// throw away any objects that happen outside of a document load
		currentDoc = 0;

		LeaveCriticalSection(&cs);

		// grab a screen shot of the document complete event
		if( saveEverything )
    {
      FindBrowserWindow();
      screenCapture.Capture(hBrowserWnd, CapturedImage::DOCUMENT_COMPLETE);
    }

		// update the waterfall
		RepaintWaterfall();
	}
	else if(szUrl == _T("about:blank"))
	{
    FindBrowserWindow();
		ResizeWindow();

		// reset the UI on an about:blank navigation		
		if( interactive && !available )
		{
			Reset();
			available = true;
		}

		// see if we have an url to test
		testUrl.Empty();
		testOptions.Empty();
		HKEY hKey;
		if( RegOpenKeyEx(HKEY_CURRENT_USER, _T("SOFTWARE\\AOL\\ieWatch"), 0, KEY_READ | KEY_WRITE, &hKey) == ERROR_SUCCESS )
		{
			// get the url value out
			TCHAR buff[4096];
			DWORD buffLen = sizeof(buff);
			if( RegQueryValueEx(hKey, _T("url"), 0, 0, (LPBYTE)buff, &buffLen) == ERROR_SUCCESS )
			{
				// delete the value since we already got it and we get a new value there for every run
				RegDeleteValue(hKey, _T("url"));
				
				// split off any options that were embedded in the url
				CString tmp = buff;
				int index = tmp.Find(_T("??pt"));
				if( index >= 0 )
				{
					testUrl = tmp.Left(index);
					testOptions = tmp.Mid(index + 2);
				}
				else
					testUrl = buff;
				
				// if we have an url to test, launch it
				if( testUrl.GetLength() ) {
					if( !testUrl.Left(9).CompareNoCase(_T("script://")) ) {
						CString script = testUrl.Right(testUrl.GetLength() - 9);
						LoadScript(script);
					}
					StartTimer(2, 100);
				}
			}

			RegCloseKey(hKey);
		}
	}
	else
	{
		CString buff;
		buff.Format(_T("[Pagetest] * Document Complete (not active) - %s\n"), (LPCTSTR)szUrl);
		OutputDebugString(buff);
	}
}
开发者ID:AceMood,项目名称:webpagetest,代码行数:96,代码来源:BrowserEvents.cpp

示例14: Uninstall


//.........这里部分代码省略.........
        // If this 64-bit dll was installed to the default location
        if (StrCmpI(szCurrentDllPath, lpszDefInstallPath) == 0)
        {
            TCHAR lpszSystemWow64[MAX_PATH + 0x20];
            uSize = GetSystemWow64Directory(lpszSystemWow64, MAX_PATH);

            if (uSize && uSize < MAX_PATH)
            {
                LPTSTR lpszSystemWow64Append = lpszSystemWow64 + uSize;

                if (*(lpszSystemWow64Append - 1) != TEXT('\\'))
                    SSCpy2Ch(lpszSystemWow64Append++, TEXT('\\'), 0);

                StringCbCopyEx(lpszDefInstallPath, sizeof(lpszDefInstallPath), lpszSystemWow64, &lpszPathAppend, NULL, 0);

                SSStaticCpy(lpszPathAppend, szFolderAndFilename);

                // If the 32-bit dll exists in its default location
                if (PathFileExists(lpszDefInstallPath))
                {
                    static const TCHAR szRegsvr32[] = TEXT("regsvr32.exe");
                    SSStaticCpy(lpszSystemWow64Append, szRegsvr32);
                    // the lpszSystemWow64 buffer now contains the full regsvr32.exe path

                    TCHAR lpszCommandLine[MAX_PATH + 0x20];
                    LPTSTR lpszCommandLineAppend;
                    
                    static const TCHAR szCommandOpts[] = TEXT("regsvr32.exe /u /i /n /s ");
                    lpszCommandLineAppend = SSStaticCpy(lpszCommandLine, szCommandOpts) - 1;

                    StringCbCopy(lpszCommandLineAppend, sizeof(lpszCommandLine)-sizeof(szCommandOpts), lpszDefInstallPath);

                    STARTUPINFO si;
                    memset(&si, 0, sizeof(si));
                    si.cb = sizeof(si);

                    PROCESS_INFORMATION pi;
                    memset(&pi, 0, sizeof(pi));

                    if (!CreateProcess(lpszSystemWow64, lpszCommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
                        return E_FAIL;

                    DWORD dwExit;
                    WaitForSingleObject(pi.hProcess, INFINITE);
                    GetExitCodeProcess(pi.hProcess, &dwExit);
                    CloseHandle(pi.hThread);
                    CloseHandle(pi.hProcess);

                    if (dwExit != 0)
                        return E_FAIL;
                }
            }
        }
    }
#endif

	// Rename the DLL prior to scheduling it for deletion
	*lpszTempAppend++ = TEXT('.');
	SSCpy2Ch(lpszTempAppend, 0, 0);

	for (TCHAR ch = TEXT('0'); ch <= TEXT('9'); ++ch)
	{
		*lpszTempAppend = ch;

		if (MoveFileEx(szCurrentDllPath, szTemp, MOVEFILE_REPLACE_EXISTING))
		{
			lpszFileToDelete = szTemp;
			break;
		}
	}

	// Schedule the DLL to be deleted at shutdown/reboot
	if (!MoveFileEx(lpszFileToDelete, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)) hr = E_FAIL;

	// Unregister
	if (DllUnregisterServer() != S_OK) hr = E_FAIL;

	// Disassociate file extensions; see the comment in DllUnregisterServer for
	// why this step is skipped for Wow64 processes
	if (!Wow64CheckProcess())
	{
		for (UINT i = 0; i < countof(g_szHashExtsTab); ++i)
		{
			HKEY hKey;

			if (hKey = RegOpen(HKEY_CLASSES_ROOT, g_szHashExtsTab[i], NULL, FALSE))
			{
                RegGetSZ(hKey, NULL, szTemp, sizeof(szTemp));
                if (_tcscmp(szTemp, PROGID_STR_HashCheck) == 0)
                    RegDeleteValue(hKey, NULL);
                RegCloseKey(hKey);
			}
		}
	}

	// We don't need the uninstall strings any more...
	RegDelete(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s"), CLSNAME_STR_HashCheck);

	return(hr);
}
开发者ID:gurnec,项目名称:HashCheck,代码行数:101,代码来源:HashCheck.cpp

示例15: main

int
main(int argc, char **argv) {
    HKEY hkSubmounts;
    HKEY hkParameters;
    char mountRoot[64]="/afs";
    char * mountstring;

    if (argc < 2 || argc > 3) {
        fprintf(stderr, "afsshare.exe <submount> [<afs mount path>]\n");
        exit(1);
    }

    if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                        AFSREG_CLT_OPENAFS_SUBKEY "\\Submounts",
                        0,
                        NULL,
                        REG_OPTION_NON_VOLATILE,
                        (IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ|KEY_WRITE,
                        NULL,
                        &hkSubmounts,
                        NULL) == ERROR_SUCCESS) 
    {
        if ( argc == 2 ) {
            if (RegDeleteValue(hkSubmounts, argv[1])) {
                fprintf(stderr,"Submount Deletion failure for [%s]: %lX",
                         argv[1], GetLastError());
                RegCloseKey(hkSubmounts);
                return 1;
            }
        } else {
            if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                AFSREG_CLT_SVC_PARAM_SUBKEY,
                                0,
                                NULL,
                                REG_OPTION_NON_VOLATILE,
                                (IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ,
                                NULL,
                                &hkParameters,
                                NULL) == ERROR_SUCCESS) 
            {
                DWORD dwSize = sizeof(mountRoot);
                RegQueryValueEx (hkParameters, "MountRoot", NULL, NULL, (PBYTE)mountRoot, &dwSize);
                RegCloseKey(hkParameters);
            }


            if ( !strncmp(mountRoot, argv[2], strlen(mountRoot)) )
                mountstring = argv[2] + strlen(mountRoot);
            else
                mountstring = argv[2];

            if (RegSetValueEx(hkSubmounts, argv[1], 0, REG_EXPAND_SZ, mountstring, (DWORD)strlen(mountstring)+1)) {
                fprintf(stderr,"Submount Set failure for [%s]: %lX",
                         argv[1], GetLastError());
                RegCloseKey(hkSubmounts);
                return 2;
            }
        }
        RegCloseKey(hkSubmounts);
    } else {
        fprintf(stderr,"Submount access denied: %lX", GetLastError());
        return 3;
    }
    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:65,代码来源:afsshare.c


注:本文中的RegDeleteValue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。