예제 #1
0
파일: win.c 프로젝트: FarGroup/FarManager
// SetRegKey (Root, Key, ValueName, DataType, ValueData [, samDesired])
//   Root:       root, [string], one of "HKLM", "HKCC", "HKCR", "HKCU", "HKU"
//   Key:        registry key, [string]
//   ValueName:  registry value name, [string]
//   DataType:   "string","expandstring","multistring","dword" or "binary", [string]
//   ValueData:  registry value data, [string | number | lstring]
//   samDesired: access mask, [flag] ("KEY_WOW64_32KEY" or "KEY_WOW64_64KEY"; the default is 0)
// Returns:
//   nothing.
static int win_SetRegKey(lua_State *L)
{
	HKEY hRoot           = CheckHKey(L, 1);
	wchar_t* Key         = (wchar_t*)check_utf8_string(L, 2, NULL);
	wchar_t* ValueName   = (wchar_t*)check_utf8_string(L, 3, NULL);
	const char* DataType = luaL_checkstring(L, 4);
	REGSAM samDesired    = (REGSAM) OptFlags(L, 6, 0);
	size_t len;
	BOOL result = FALSE;

	if(!strcmp("string", DataType))
	{
		result=SetRegKeyStr(hRoot, Key, ValueName, (wchar_t*)check_utf8_string(L, 5, NULL), samDesired);
	}
	else if(!strcmp("dword", DataType))
	{
		result=SetRegKeyDword(hRoot, Key, ValueName, (DWORD)luaL_checkinteger(L, 5), samDesired);
	}
	else if(!strcmp("binary", DataType))
	{
		BYTE *data = (BYTE*)luaL_checklstring(L, 5, &len);
		result=SetRegKeyArr(hRoot, Key, ValueName, data, (DWORD)len, samDesired);
	}
	else if(!strcmp("expandstring", DataType))
	{
		const wchar_t* data = check_utf8_string(L, 5, &len);
		HKEY hKey = CreateRegKey(hRoot, Key, samDesired);
		if (hKey)
		{
			result = (ERROR_SUCCESS == RegSetValueExW(hKey, ValueName, 0, REG_EXPAND_SZ, (BYTE*)data,
				(DWORD)((1+len)*sizeof(wchar_t))));
			RegCloseKey(hKey);
		}
	}
	else if(!strcmp("multistring", DataType))
	{
		const wchar_t* data = check_utf8_string(L, 5, &len);
		HKEY hKey = CreateRegKey(hRoot, Key, samDesired);
		if (hKey)
		{
			result = (ERROR_SUCCESS == RegSetValueExW(hKey, ValueName, 0, REG_MULTI_SZ, (BYTE*)data,
				(DWORD)((1+len)*sizeof(wchar_t))));
			RegCloseKey(hKey);
		}
	}
	else
		luaL_argerror(L, 5, "unsupported value type");

	lua_pushboolean(L, result==FALSE ? 0:1);
	return 1;
}
예제 #2
0
void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
    LPCTSTR valueName, bool value) const
{
  NRegistry::CKey regKey;
  CreateRegKey(parentKey, keyName, regKey);
  regKey.SetValue(valueName, value);
}
예제 #3
0
파일: reg.c 프로젝트: shmuz/LuaFAR
void SetRegKeyStr(HKEY hRoot, wchar_t *Key, wchar_t *ValueName, wchar_t *ValueData)
{
    HKEY hKey=CreateRegKey(hRoot, Key);
    RegSetValueExW(hKey, ValueName, 0, REG_SZ, (BYTE*)ValueData,
                   sizeof(wchar_t) * ((DWORD)wcslen(ValueData) + 1));
    RegCloseKey(hKey);
}
예제 #4
0
// cf. http://msdn.microsoft.com/en-us/library/cc144148(v=vs.85).aspx
static bool WriteExtendedFileExtensionInfo(HKEY hkey)
{
    bool success = true;

    ScopedMem<WCHAR> exePath(GetInstalledExePath());
    if (HKEY_LOCAL_MACHINE == hkey)
        success &= WriteRegStr(hkey, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" EXENAME, NULL, exePath);

    // mirroring some of what DoAssociateExeWithPdfExtension() does (cf. AppTools.cpp)
    ScopedMem<WCHAR> iconPath(str::Join(exePath, L",1"));
    success &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\DefaultIcon", NULL, iconPath);
    ScopedMem<WCHAR> cmdPath(str::Format(L"\"%s\" \"%%1\" %%*", exePath));
    success &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\Shell\\Open\\Command", NULL, cmdPath);
    ScopedMem<WCHAR> printPath(str::Format(L"\"%s\" -print-to-default \"%%1\"", exePath));
    success &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\Shell\\Print\\Command", NULL, printPath);
    ScopedMem<WCHAR> printToPath(str::Format(L"\"%s\" -print-to \"%%2\" \"%%1\"", exePath));
    success &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\Shell\\PrintTo\\Command", NULL, printToPath);
    // don't add REG_CLASSES_APPS L"\\SupportedTypes", as that prevents SumatraPDF.exe to
    // potentially appear in the Open With lists for other filetypes (such as single images)

    // add the installed SumatraPDF.exe to the Open With lists of the supported file extensions
    for (int i = 0; NULL != gSupportedExts[i]; i++) {
        ScopedMem<WCHAR> keyname(str::Join(L"Software\\Classes\\", gSupportedExts[i], L"\\OpenWithList\\" EXENAME));
        success &= CreateRegKey(hkey, keyname);
        // TODO: stop removing this after version 1.8 (was wrongly created for version 1.6)
        keyname.Set(str::Join(L"Software\\Classes\\", gSupportedExts[i], L"\\OpenWithList\\" APP_NAME_STR));
        DeleteRegKey(hkey, keyname);
    }

    // in case these values don't exist yet (we won't delete these at uninstallation)
    success &= WriteRegStr(hkey, REG_CLASSES_PDF, L"Content Type", L"application/pdf");
    success &= WriteRegStr(hkey, L"Software\\Classes\\MIME\\Database\\Content Type\\application/pdf", L"Extension", L".pdf");

    return success;
}
예제 #5
0
int EnumRegKey( const char *key, void (*save)( char *name, char *val, void *data ), void *data )
{

	HKEY hKey = OpenRegKey( key );
	int res = ERROR_SUCCESS;
	char name[MAX_PATH], val[MAX_PATH];

	if( !hKey )
		hKey = CreateRegKey( key );

	if( !hKey )
		return 0;

	for( int index = 0; res == ERROR_SUCCESS; index++ ) {

		unsigned long sz1, sz2, type;

		sz1 = sz2 = MAX_PATH;

		res = RegEnumValue( hKey, index, name, &sz1, NULL, &type, (BYTE*)val, &sz2 );
		if( res == ERROR_SUCCESS && type == REG_SZ ) {
			save(name, val, data);
		}
	}

	RegCloseKey(hKey);
	return 1;
}
예제 #6
0
BOOL SetRegString(HKEY hkBase, char *szKeyName, char *szValueName, char *lpBuffer) {
	HKEY hkey;
	BOOL success;

	if (!(hkey = CreateRegKey(hkBase, szKeyName)))
		return FALSE;

	success = (ERROR_SUCCESS == RegSetValueEx(hkey, szValueName, 0, REG_SZ, (LPBYTE)lpBuffer, strlen(lpBuffer)+1));

	RegCloseKey(hkey);

	return success;
}
예제 #7
0
static NTSTATUS
CreateProtoHive(
    OUT PHANDLE KeyHandle)
{
    NTSTATUS Status;
    UNICODE_STRING KeyName;

    RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\SYSTEM\\$$$PROTO.HIV");
    Status = CreateRegKey(KeyHandle,
                          NULL,
                          &KeyName,
                          REG_OPTION_NON_VOLATILE,
                          NULL);
    if (!NT_SUCCESS(Status))
        return Status;

    NtFlushKey(KeyHandle);
    return Status;
}
예제 #8
0
// cf. http://msdn.microsoft.com/en-us/library/cc144148(v=vs.85).aspx
static bool WriteExtendedFileExtensionInfo(HKEY hkey)
{
    bool ok = true;

    ScopedMem<WCHAR> exePath(GetInstalledExePath());
    if (HKEY_LOCAL_MACHINE == hkey)
        ok &= WriteRegStr(hkey, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" EXENAME, nullptr, exePath);

    // mirroring some of what DoAssociateExeWithPdfExtension() does (cf. AppTools.cpp)
    ScopedMem<WCHAR> iconPath(str::Join(exePath, L",1"));
    ok &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\DefaultIcon", nullptr, iconPath);
    ScopedMem<WCHAR> cmdPath(str::Format(L"\"%s\" \"%%1\" %%*", exePath));
    ok &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\Shell\\Open\\Command", nullptr, cmdPath);
    ScopedMem<WCHAR> printPath(str::Format(L"\"%s\" -print-to-default \"%%1\"", exePath));
    ok &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\Shell\\Print\\Command", nullptr, printPath);
    ScopedMem<WCHAR> printToPath(str::Format(L"\"%s\" -print-to \"%%2\" \"%%1\"", exePath));
    ok &= WriteRegStr(hkey, REG_CLASSES_APPS L"\\Shell\\PrintTo\\Command", nullptr, printToPath);
    // don't add REG_CLASSES_APPS L"\\SupportedTypes", as that prevents SumatraPDF.exe to
    // potentially appear in the Open With lists for other filetypes (such as single images)

    // add the installed SumatraPDF.exe to the Open With lists of the supported file extensions
    // TODO: per http://msdn.microsoft.com/en-us/library/cc144148(v=vs.85).aspx we shouldn't be
    // using OpenWithList but OpenWithProgIds. Also, it doesn't seem to work on my win7 32bit
    // (HKLM\Software\Classes\.mobi\OpenWithList\SumatraPDF.exe key is present but "Open With"
    // menu item doesn't even exist for .mobi files
    // It's not so easy, though, because if we just set it to SumatraPDF,
    // all gSupportedExts will be reported as "PDF Document" by Explorer, so this needs
    // to be more intelligent. We should probably mimic Windows Media Player scheme i.e.
    // set OpenWithProgIds to SumatraPDF.AssocFile.Mobi etc. and create apropriate
    // \SOFTWARE\Classes\CLSID\{GUID}\ProgID etc. entries
    // Also, if Sumatra is the only program handling those docs, our
    // PDF icon will be shown (we need icons and properly configure them)
    for (int i = 0; nullptr != gSupportedExts[i]; i++) {
        ScopedMem<WCHAR> keyname(str::Join(L"Software\\Classes\\", gSupportedExts[i], L"\\OpenWithList\\" EXENAME));
        ok &= CreateRegKey(hkey, keyname);
    }

    // in case these values don't exist yet (we won't delete these at uninstallation)
    ok &= WriteRegStr(hkey, REG_CLASSES_PDF, L"Content Type", L"application/pdf");
    ok &= WriteRegStr(hkey, L"Software\\Classes\\MIME\\Database\\Content Type\\application/pdf", L"Extension", L".pdf");

    return ok;
}
예제 #9
0
bool History::SaveHistory()
{
	if (!*EnableSave)
		return true;

	if (!HistoryList.Count())
	{
		DeleteRegKey(strRegKey);
		return true;
	}

	//for dialogs, locked items should show first (be last in the list)
	if (TypeHistory == HISTORYTYPE_DIALOG)
	{
		for (const HistoryRecord *HistoryItem=HistoryList.First(), *LastItem=HistoryList.Last(); HistoryItem; )
		{
			const HistoryRecord *tmp = HistoryItem;

			HistoryItem=HistoryList.Next(HistoryItem);

			if (tmp->Lock)
				HistoryList.MoveAfter(HistoryList.Last(), tmp);

			if (tmp == LastItem)
				break;
		}
	}

	wchar_t *TypesBuffer=nullptr;

	if (SaveType)
	{
		TypesBuffer=(wchar_t *)xf_malloc((HistoryList.Count()+1)*sizeof(wchar_t));

		if (!TypesBuffer)
			return false;
	}

	wchar_t *LocksBuffer=nullptr;

	if (!(LocksBuffer=(wchar_t *)xf_malloc((HistoryList.Count()+1)*sizeof(wchar_t))))
	{
		if (TypesBuffer)
			xf_free(TypesBuffer);

		return false;
	}

	FILETIME *TimesBuffer=nullptr;

	if (!(TimesBuffer=(FILETIME *)xf_malloc((HistoryList.Count()+1)*sizeof(FILETIME))))
	{
		if (LocksBuffer)
			xf_free(LocksBuffer);

		if (TypesBuffer)
			xf_free(TypesBuffer);

		return false;
	}

	memset(TimesBuffer,0,(HistoryList.Count()+1)*sizeof(FILETIME));
	wmemset(LocksBuffer,0,HistoryList.Count()+1);

	if (SaveType)
		wmemset(TypesBuffer,0,HistoryList.Count()+1);

	bool ret = false;
	HKEY hKey = nullptr;
	wchar_t *BufferLines=nullptr, *PtrBuffer;
	size_t SizeLines=0, SizeTypes=0, SizeLocks=0, SizeTimes=0;
	int Position = -1;
	size_t i=HistoryList.Count()-1;

	for (const HistoryRecord *HistoryItem=HistoryList.Last(); HistoryItem ; HistoryItem=HistoryList.Prev(HistoryItem))
	{
		if (!(PtrBuffer=(wchar_t*)xf_realloc(BufferLines,(SizeLines+HistoryItem->strName.GetLength()+2)*sizeof(wchar_t))))
		{
			ret = false;
			goto end;
		}

		BufferLines=PtrBuffer;
		xwcsncpy(BufferLines+SizeLines,HistoryItem->strName,HistoryItem->strName.GetLength()+1);
		SizeLines+=HistoryItem->strName.GetLength()+1;

		if (SaveType)
			TypesBuffer[SizeTypes++]=HistoryItem->Type+L'0';

		LocksBuffer[SizeLocks++]=HistoryItem->Lock+L'0';
		TimesBuffer[SizeTimes].dwLowDateTime=HistoryItem->Timestamp.dwLowDateTime;
		TimesBuffer[SizeTimes].dwHighDateTime=HistoryItem->Timestamp.dwHighDateTime;
		SizeTimes++;

		if (HistoryItem == CurrentItem)
			Position = static_cast<int>(i);

		i--;
	}

	hKey=CreateRegKey(strRegKey);

	if (hKey)
	{
		RegSetValueEx(hKey,L"Lines",0,REG_MULTI_SZ,(unsigned char *)BufferLines,static_cast<DWORD>(SizeLines*sizeof(wchar_t)));

		if (SaveType)
			RegSetValueEx(hKey,L"Types",0,REG_SZ,(unsigned char *)TypesBuffer,static_cast<DWORD>((SizeTypes+1)*sizeof(wchar_t)));

		RegSetValueEx(hKey,L"Locks",0,REG_SZ,(unsigned char *)LocksBuffer,static_cast<DWORD>((SizeLocks+1)*sizeof(wchar_t)));
		RegSetValueEx(hKey,L"Times",0,REG_BINARY,(unsigned char *)TimesBuffer,(DWORD)SizeTimes*sizeof(FILETIME));
		RegSetValueEx(hKey,L"Position",0,REG_DWORD,(BYTE *)&Position,sizeof(Position));
		RegCloseKey(hKey);
		ret = true;
	}

end:

	if (BufferLines)
		xf_free(BufferLines);

	if (TypesBuffer)
		xf_free(TypesBuffer);

	if (LocksBuffer)
		xf_free(LocksBuffer);

	if (TimesBuffer)
		xf_free(TimesBuffer);

	return ret;
}
예제 #10
0
파일: arcreg.cpp 프로젝트: elfmz/far2l
void SetRegKey(HKEY hRoot,const char *Key,const char *ValueName,DWORD ValueData)
{
  HKEY hKey=CreateRegKey(hRoot,Key);
  WINPORT(RegSetValueEx)(hKey,MB2Wide(ValueName).c_str(),0,REG_DWORD,(BYTE *)&ValueData,sizeof(ValueData));
  WINPORT(RegCloseKey)(hKey);
}
예제 #11
0
// для значения с именем ValueName установить значение типа char*
void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,TCHAR *ValueData)
{
	HKEY hKey=CreateRegKey(hRoot,Key);
	RegSetValueEx(hKey,ValueName,0,REG_SZ,(const BYTE*)ValueData,(lstrlen(ValueData)+1)*sizeof(TCHAR));
	RegCloseKey(hKey);
}
예제 #12
0
// установить значение типа Binary
void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,BYTE *ValueData,DWORD ValueSize)
{
	HKEY hKey=CreateRegKey(hRoot,Key);
	RegSetValueEx(hKey,ValueName,0,REG_BINARY,ValueData,ValueSize);
	RegCloseKey(hKey);
}
예제 #13
0
bool EnsureRegKey(const WCHAR *lpKey)
{
    CreateRegKey(HKEY_LOCAL_MACHINE, lpKey);
    return CreateRegKey(HKEY_CURRENT_USER, lpKey);
}
예제 #14
0
파일: Reg.cpp 프로젝트: crom83/cromfarplugs
void SetRegKey(HKEY hRoot, BOOL bEx, const TCHAR *Key,const TCHAR *ValueName,const CString &ValueData)
{
  HKEY hKey=CreateRegKey(hRoot, bEx, Key);
  RegSetValueEx(hKey,ValueName,0,REG_SZ,(const BYTE*)(LPCTSTR)ValueData,(ValueData.GetLength()+1)*sizeof(TCHAR));
  RegCloseKey(hKey);
}
예제 #15
0
HRESULT Register_IF(pCHAR pszDllPath, pCCHAR pszPROGID, pCCHAR pszPROGID_DESC, pCCHAR pszPROGID_CURVER,
   pCCHAR pszPROGID_VERINDEP, REFGUID pClsId, BOOL bReg)
{
   HRESULT rslt = SELFREG_E_CLASS;
   BYTE ClassIdStr_W[100];
   CHAR ClassIdStr[100];
   // LPCWSTR pClassIdStr_W = (LPCWSTR) &ClassIdStr_W;
   // UINT32  iStrLen = 100;

   if (StringFromGUID2(pClsId, (LPOLESTR)ClassIdStr_W, 100) != 0) // (returns len)
   {
      CHAR szBuf[100];
      pCHAR pMarker;

      // ClassID in unicode. Convert to ANSI.
      WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)ClassIdStr_W, -1, ClassIdStr, 100, NULL, NULL);

      if (bReg)
      {
         HKEY hKey = NULL;

         // PROGID-entry
         lstrcpy(szBuf, pszPROGID);
         // "Borland.DbClient = Borland Client Engine"
         CreateRegKey(szBuf, NULL, pszPROGID_DESC);

         pMarker = &szBuf[lstrlen(szBuf)]; // Points to 0
         lstrcat(szBuf, "\\Clsid");
         // "Borland.DbClient\Clsid = {12343-22 ..}"
         CreateRegKey(szBuf, NULL, ClassIdStr);
         if (pszPROGID_CURVER)
         {
            *pMarker = 0;
            lstrcat(szBuf, "\\CurVer");
            // "Borland.DbClient\CurVer = DSBASE.2"
            CreateRegKey(szBuf, NULL, pszPROGID_CURVER);
            rslt = 0;
         }
         else
         {
            // CLSID-entry
            lstrcpy(szBuf, "CLSID\\"); // "CLDID\"
            lstrcat(szBuf, ClassIdStr);
            // "CLDID\{121212 .. } = Borland Client Engine"
            CreateRegKey(szBuf, NULL, pszPROGID_DESC);
            // ProgID
            pMarker = &szBuf[lstrlen(szBuf)]; // Points to 0
            lstrcat(szBuf, "\\ProgID");
            // "CLDID\{121212 .. }\ProgID = Borland.DbClient"
            CreateRegKey(szBuf, NULL, pszPROGID);
            // InProcServer
            *pMarker = 0; //
            lstrcat(szBuf, "\\InProcServer32");
            // "CLDID\{121212 .. }\InProcServer32 = <j:\t4d\dbclient.dll>"
            CreateRegKey(szBuf, NULL, pszDllPath);
            // We need to add an additional value.
            rslt = RegOpenKeyEx(HKEY_CLASSES_ROOT, szBuf, '\0', KEY_SET_VALUE, &hKey);
            if (rslt == 0)
            {
               // "CLDID\{121212 .. }\InProcServer32 = "ThreadingModel = <Apartment>"
               RegSetValueEx(hKey, "ThreadingModel", 0, REG_SZ, (CONST BYTE*)"Apartment", 10);
               RegCloseKey(hKey);
            }
            rslt = 0; // Succeded

            // VersionIndependentProgID
            if (pszPROGID_VERINDEP)
            {
               *pMarker = 0; //
               lstrcat(szBuf, "\\VersionIndependentProgID");
               // "CLDID\{121212 .. }\InProcServer32 = <j:\t4d\dbclient.dll>"
               CreateRegKey(szBuf, NULL, pszPROGID_VERINDEP);
            }
            *pMarker = 0;

         }
      }
      else
      {
         // Delete CLSID

         if (pszPROGID_CURVER == NULL)
         {
            lstrcpy(szBuf, "CLSID\\");
            lstrcat(szBuf, ClassIdStr);
            pMarker = &szBuf[lstrlen(szBuf)]; // Points to 0

            *pMarker = 0; //
            lstrcat(szBuf, "\\InProcServer32");
            DeleteRegKey(szBuf);

            *pMarker = 0; //
            lstrcat(szBuf, "\\ProgID");
            DeleteRegKey(szBuf);

            *pMarker = 0; //
            lstrcat(szBuf, "\\VersionIndependentProgID");
            DeleteRegKey(szBuf);

            *pMarker = 0; //
            DeleteRegKey(szBuf);
         }

         // delete PROGID
         lstrcpy(szBuf, pszPROGID);
         pMarker = &szBuf[lstrlen(szBuf)]; // Points to 0
         lstrcat(szBuf, "\\Clsid");
         DeleteRegKey(szBuf);
         *pMarker = 0; //
         lstrcat(szBuf, "\\CurVer");
         DeleteRegKey(szBuf);
         *pMarker = 0; //
         DeleteRegKey(szBuf);
         rslt = 0; // Succeded
      }
   }
   return rslt;
}
예제 #16
0
파일: arcreg.cpp 프로젝트: CyberShadow/FAR
void SetRegKey(HKEY hRoot,const char *Key,const char *ValueName,char *ValueData)
{
  HKEY hKey=CreateRegKey(hRoot,Key);
  RegSetValueEx(hKey,ValueName,0,REG_SZ,(BYTE*)ValueData,lstrlen(ValueData)+1);
  RegCloseKey(hKey);
}
예제 #17
0
파일: arcreg.cpp 프로젝트: elfmz/far2l
void SetRegKey(HKEY hRoot,const char *Key,const char *ValueName,char *ValueData)
{
  HKEY hKey=CreateRegKey(hRoot,Key);
  WINPORT(RegSetValueEx)(hKey,MB2Wide(ValueName).c_str(),0,REG_SZ_MB,(BYTE*)ValueData,strlen(ValueData)+1);
  WINPORT(RegCloseKey)(hKey);
}
예제 #18
0
파일: arcreg.cpp 프로젝트: CyberShadow/FAR
void SetRegKey(HKEY hRoot,const char *Key,const char *ValueName,DWORD ValueData)
{
  HKEY hKey=CreateRegKey(hRoot,Key);
  RegSetValueEx(hKey,ValueName,0,REG_DWORD,(BYTE *)&ValueData,sizeof(ValueData));
  RegCloseKey(hKey);
}
예제 #19
0
파일: reg.c 프로젝트: shmuz/LuaFAR
void SetRegKeyDword(HKEY hRoot, wchar_t *Key, wchar_t *ValueName, DWORD ValueData)
{
    HKEY hKey=CreateRegKey(hRoot, Key);
    RegSetValueExW(hKey, ValueName, 0, REG_DWORD, (BYTE *)&ValueData, sizeof(DWORD));
    RegCloseKey(hKey);
}
예제 #20
0
파일: reg.c 프로젝트: shmuz/LuaFAR
void SetRegKeyArr(HKEY hRoot, wchar_t *Key, wchar_t *ValueName, BYTE *ValueData, DWORD ValueSize)
{
    HKEY hKey=CreateRegKey(hRoot, Key);
    RegSetValueExW(hKey, ValueName, 0, REG_BINARY, ValueData, ValueSize);
    RegCloseKey(hKey);
}
예제 #21
0
bool EnsureRegKey(LPCTSTR lpKey)
{
    CreateRegKey(HKEY_LOCAL_MACHINE, lpKey);
    return CreateRegKey(HKEY_CURRENT_USER, lpKey);
}