People, hello! I work on c++ bulder c registry.
That was the floor of the Internet, but something guessed there.
That's the thing, make up a program on Bulder ( Bulder way, a good language, there is nothing superfluous). So, somehow I got annoyed to manually add my specific parameters after installing fresh windows , and finally decided to compile a program that does everything for me according to the algorithm I compiled, well, there’s a catch, I understood how to add the DWORD parameter by small experiments, but I have DWORD it turns out with either a value of one or zero with setting a parameter or NULL - zero false - zero and true - 1. So, I want to understand how to make a parameter in hexadecimal representation of a type ( 0xFF ) using a boolean value. But the source code with practices

 void __fastcall TForm1::Button1Click(TObject *Sender) { TRegistry *reg=new TRegistry; reg->RootKey=HKEY_CURRENT_USER; reg->OpenKey("\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",true); reg->WriteBool("NoDriveTypeAutoRun", "0xFF"); // Здесь хлчу добавить параметр 0xFF, а он не идёт, в реестре нуль reg->CloseKey(); Application->MessageBox("Параметр добавлен", "Registry", MB_OK | MB_ICONINFORMATION); delete reg; } 

I will add a question reg->WriteInteger("NoDriveTypeAutoRun",255 ); So, you need to add what I wrote above, and when you write a numerical value, it is in the FF registry that 255, that the thread is different, you write out very clumsy data. What to do ?

  • one
    write a hex value with a boolean key using the string? Monsieur knows a lot about perversions. - KoVadim
  • Well, as luchshe and in types not really, expiremet (learn) by typing. In general, I just started to learn this language, I liked it because of the fact that the program on it weighs little. And on delphi weighs 1 megabyte with something. - Arsenty Suvorov
  • Well, in fact, it also weighs a lot on the builder. And at Delphi, you can do ten kilobytes. It will all turn out when you take your project to another computer where there is no builder. Once you WriteBool , look at this and note that the WriteBool and other Write* functions have three parameters, not two. - KoVadim
  • > I study at random, I hope you don’t learn at random with women? - DreamChild
  • Probably weighs a lot because it doesn’t relize (debugging information) well, exe itself weighs a little, and in operative something is 4400 kilobytes, weird ... And on delphi exe megabyte weighs ... - Arsenty Suvorov


1 answer 1

The method of typing does not help, only rtfm. You are using the wrong method. You write boolean, but you need Integer.

 reg->WriteInteger("NoDriveTypeAutoRun", 255); 
  • 255 in the parameter 41ff and we need 0xFF, How to find out? Thanks in advance. - Arsenty Suvorov
  • Which hex editor does this define? Schaya I will clarify 255 this is ff, simply. But in another way, this is a transformation, I just forgot it. - Arsenty Suvorov
  • A integer just didn’t try it (I’m afraid of a compiler error), and thanks for the useful hint, I’ll deal with the code in the afternoon. - Arsenty Suvorov