[C++]Base de registre

teebo Messages postés 33491 Date d'inscription   Statut Modérateur Dernière intervention   -  
 b1mfhp77 -
Salut tout le monde,
Je suis toujours sur mon appli pour la base des registre. Mon probleme actuellement est que pour ecrire une string je n'ai pas de probleme mais pour ecrire tous les autres types de donnees je me retrouve avec des conneries...
Exemple:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Synergy\Synergy]
"server"=""
"stringvalue"="dU"
"binaryvalue"=hex:64,55,00,90
"multistringvalue"=hex(7):64,00,55,00,00,00,50,00
"expandablestringvalue"=hex(2):cd,00,cd,00,cd,00,cd,00

au lieu de

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\SynergyMaster\Synergy]
"server"=""
"debug"=dword:00000003
"isServer"=dword:00000001
"stringvalue"="dfv"
"binaryvalue"=hex:01,01,10,11,10,00,11,01,10
"multistringvalue"=hex(7):6a,00,65,00,20,00,73,00,61,00,69,00,73,00,20,00,70,\
00,61,00,73,00,00,00,63,00,65,00,20,00,71,00,75,00,65,00,20,00,63,00,27,00,\
65,00,73,00,74,00,00,00,71,00,75,00,65,00,20,00,63,00,65,00,20,00,74,00,72,\
00,75,00,63,00,00,00,00,00
"expandablestringvalue"=hex(2):71,00,75,00,65,00,73,00,61,00,6b,00,69,00,00,00

.  .
\_/
      Heeeeeeuuuuuuu

4 réponses

teebo Messages postés 33491 Date d'inscription   Statut Modérateur Dernière intervention   1 793
 
Ca c'est le resultat de mon dernier essai en date, les DWORD disparaissent carrement alors que j'ai pourtant un DWORD mais je peux aussi avoir ca comme resultat:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Synergy\Synergy]
"server"=""
"stringvalue"="dfv"
"binaryvalue"=hex:30,31,2c,30
"multistringvalue"=hex(7):36,00,61,00,2c,00,30,00
"expandablestringvalue"=hex(2):37,00,31,00,2c,00,30,00
"debug"=dword:30303030
"isServer"=dword:30303030


.  .
\_/
      Heeeeeeuuuuuuu
1
teebo Messages postés 33491 Date d'inscription   Statut Modérateur Dernière intervention   1 793
 
Je rentre mes variables la:

void wordXML::load (IXMLDOMElementPtr elt)
{
	//string name;
	string temp;
	elementRoot=elt;
	type=3;

	//Fill word value name and size
	this->getatt ("name",wdName);
	
	//wdName=name.c_str ();
    
	temp=elementRoot->text;
	int sep=temp.find_first_of (':');
	int end = (int)temp.length() ; 
	if (sep<2)
	{
		wdValue=new BYTE[temp.length()+1];
		memset(wdValue,0,temp.length()+1);
		memcpy(wdValue,temp.c_str (),temp.length());
		//wdValue=(DWORD)temp.c_str();
		wdType=REG_SZ;
		wdSize=sizeof(REG_SZ);
	}
	else
	{
		wdValue=new BYTE [temp.substr(sep+1,end).length()+1];
		memset(wdValue,0,temp.substr(sep+1,end).length()+1);
		memcpy(wdValue,temp.substr(sep+1,end).c_str (),temp.substr(sep+1,end).length());
//		wdValue=(DWORD)temp.substr(sep+1,end).c_str ();
		string temp2=temp.substr(0,sep);
		if (temp2.compare ("hex")==0 )
		{
		//	wdValue=temp.substr (sep+1,end).c_str ();
			wdType=REG_BINARY;
			wdSize=sizeof(REG_BINARY);
		}
		else if (temp2.compare("hex(7)")==0) 
		{
		//	wdValue=temp.substr (sep+1,end).c_str ();
			wdType=REG_MULTI_SZ;
			wdSize=sizeof(REG_MULTI_SZ);
		}
		else if (temp2.compare("hex(2)")==0) 
		{
		//	wdValue=temp.substr (sep+1,end).c_str ();
			wdType=REG_EXPAND_SZ;
			wdSize=sizeof(REG_EXPAND_SZ);
		}
		else//dword most probably 
		{
		//	wdValue=temp.substr (sep+1,end).c_str ();
		//	wdValue=(DWORD)1;
			wdType=REG_DWORD;
			wdSize=sizeof(REG_DWORD);
		}
	}
}


.  .
\_/
      Heeeeeeuuuuuuu
0
teebo Messages postés 33491 Date d'inscription   Statut Modérateur Dernière intervention   1 793
 
Et j'ecris dans mon registre ici:

int wordXML::writeReg(HKEY * openedKey)
{
	RegSetValueEx(*openedKey,wdName.c_str (),0,wdType,(BYTE *)wdValue,wdSize);
	return 0;
}


.  .
\_/
      Heeeeeeuuuuuuu
0
b1mfhp77
 
je voudrais avoir des nouvelles cles de la basse de registre?
pour amiliorer toute la programation de windows xp professionnel
merci ,Maurice Tremblay, de dolbeau-mistassini,lac saintjean,
conte roberval.
0