HKEY OpenRegKey(HKEY hRoot,const char *Key) { HKEY hKey; char FullKeyName[512]; if (RegOpenKeyEx(hRoot,CreateKeyName(FullKeyName,Key),0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) return NULL; return hKey; }
HKEY OpenRegKey(HKEY hRoot,const char *Key) { HKEY hKey; char FullKeyName[512]; if (WINPORT(RegOpenKeyEx)(hRoot, MB2Wide(CreateKeyName(FullKeyName,Key)).c_str(), 0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) return NULL; return hKey; }
HKEY CreateRegKey(HKEY hRoot,const char *Key) { HKEY hKey; DWORD Disposition; char FullKeyName[512]; RegCreateKeyEx(hRoot,CreateKeyName(FullKeyName,Key),0,NULL,0,KEY_WRITE,NULL, &hKey,&Disposition); return hKey; }
HKEY CreateRegKey(HKEY hRoot,const char *Key) { HKEY hKey; DWORD Disposition; char FullKeyName[512]; WINPORT(RegCreateKeyEx)(hRoot, MB2Wide(CreateKeyName(FullKeyName,Key)).c_str(),0,NULL,0,KEY_WRITE,NULL, &hKey,&Disposition); return hKey; }
void DeleteRegValue(HKEY hRoot,const char *Key,const char *ValueName) { HKEY hKey; char FullKeyName[512]; if (RegOpenKeyEx(hRoot,CreateKeyName(FullKeyName,Key),0,KEY_WRITE,&hKey)==ERROR_SUCCESS) { RegDeleteValue(hKey,ValueName); RegCloseKey(hKey); } }
void DeleteRegValue(HKEY hRoot,const char *Key,const char *ValueName) { HKEY hKey; char FullKeyName[512]; if (WINPORT(RegOpenKeyEx)(hRoot, MB2Wide(CreateKeyName(FullKeyName,Key)).c_str(),0,KEY_WRITE,&hKey)==ERROR_SUCCESS) { WINPORT(RegDeleteValue)(hKey, MB2Wide(ValueName).c_str()); WINPORT(RegCloseKey)(hKey); } }
void OpFileSystem::CreateDirectorySnapshot( const NrpText& directory, const NrpText& templateName, const NrpText& itemName, IniFile* ini, const NrpText& funcUpdate ) { _wfinddata_t fdata; intptr_t hFile; assert( directory.size() ); if( directory.size() ) { hFile = _wfindfirst( ( CheckEndSlash( directory )+ anyFile ).ToWide(), &fdata); while( hFile ) { if ( !( firstEntry == fdata.name || secondEntry == fdata.name ) )// это удалять не надо if ((( fdata.attrib & _A_SUBDIR ) == _A_SUBDIR ) || ( fdata.attrib == _A_SUBDIR ))// найдена папка { CreateDirectorySnapshot( CheckEndSlash( directory ) + NrpText( fdata.name ), templateName, itemName, ini, funcUpdate ); } else// иначе найден файл { if( _wcsicmp( itemName.ToWide(), fdata.name ) == 0 ) { NrpText fileName = CheckEndSlash( directory )+ fdata.name; IniFile rv( fileName ); int number= ini->Get( SECTION_OPTIONS, templateName + numTemplate, (int)0 ); NrpText intName = rv.Get( SECTION_PROPERTIES, INrpConfig::uniqTemplate, NrpText( "" ) ); ini->Set( SECTION_OPTIONS, CreateKeyName( number ), intName ); ini->Set( SECTION_OPTIONS, templateName + NrpText( (int)number ), fileName ); ini->Set( SECTION_OPTIONS, templateName + numTemplate, number+1 ); if( funcUpdate.size() && GetTickCount() - lastTimeUpdate > 500 ) { lastTimeUpdate = GetTickCount(); CNrpScript::Instance().DoString( funcUpdate + "(" + NrpText( number ) + ")" ); } } } if( _wfindnext( hFile, &fdata) != 0 ) break; } } _findclose( hFile ); }
void DeleteRegKey(HKEY hRoot,const char *Key) { char FullKeyName[512]; RegDeleteKey(hRoot,CreateKeyName(FullKeyName,Key)); }
void DeleteRegKey(HKEY hRoot,const char *Key) { char FullKeyName[512]; WINPORT(RegDeleteKey)(hRoot, MB2Wide(CreateKeyName(FullKeyName,Key)).c_str()); }