Modify one bit in Windows registry lazarus / 34-Windows ---------------------------------------------------------------------- martin159 · 2013-09-13 10:11 Hi, I am writing simple application to easy mount WebDAV share in Windows 7. App works fine, but WebDAV is extremely slow - there is an error in Windows 7. For fix it user must do: Quote1. Start Internet Explorer. 2. Click Tools, and then click Internet Options. 3. Click the Connections tab, and then click LAN Settings. 4. De-select Automatically detect settings. 5. Click OK and test functionality.it is to complicated. An other way is modify Windows user registry. It is 9th bit. Entry in registry is: Code: [Select]Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections] "DefaultConnectionSettings"=hex:46,00,00,00,36,00,00,00,01,00,00,00,00 ,00,00,\   00,07,00,00,00,3c,6c,6f,63,61,6c,3e,00,00,00,00,00,00,00,00,00,00,00 ,00,30,\   85,62,3f,e8,ae,ce,01,00,00,00,00,00,00,00,00,00,00,00,00,04,00,00,00 ,17,00,\   00,00,00,00,00,00,fe,80,00,00,00,00,00,00,55,0f,93,fe,4c,74,4c,51,12 ,00,00,\   00,00,00,00,00,17,00,00,00,00,00,00,00,fe,80,00,00,00,00,00,00,55,0f ,93,fe,\   4c,74,4c,51,12,00,00,00,00,00,00,00,1c,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,17,00,00,00 ,00,00,\   00,00,fe,80,00,00,00,00,00,00,54,eb,d1,9b,c4,14,c6,ef,0b,00,00,00,00 ,00,00,\   00,17,00,00,00,00,00,00,00,fe,80,00,00,00,00,00,00,54,eb,d1,9b,c4,14 ,c6,ef,\   0b,00,00,00,00,00,00,00,17,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,ff,ff,c0,a8,01,0a,00,00,00,00,00,00,00,00,1c,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,17 ,00,00,\   00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,ff,ff,a9,fe,4c,51,00,00 ,00,00,\   00,00,00,00,02,00,00,00,a9,fe,4c,51,00,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,00,00,00,00,00,01,00,01,c0,76,00,00,f8,24,4a,00 ,48,9a,\   49,00,9c,1b,4a,00,00,00,00,00,00,00,00,00,00,00,00,00,fc,00,00,fc,cc ,76,00,\   00,f8,24,4a,00,48,9a,49,00,00,10,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,02,00,00,00,c0,a8,01,0a,00,00,00,00,00,00,00,00 ,04,00,\   00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 ,00,00,\   00,00,00,00,00,00,00,0a,00,00,00,00,00,00,00,70,1a,4a,00,98,23,4a,00 ,00,00,\   00,00,04,00,00,00,f2,76,00,00but I need modify only 9th bit (other settings must be do not modified by my app). I would like to use this source code. How can I modify only 9th bit from Lazarus app? Thank you your for help! ---------------------------------------------------------------------- User137 · 2013-09-13 10:54 If you load the value in as string, 9th bit is located in first bit of second byte/char. Change that one and rewrite the string value in registry. TRegistry didn't have direct bit manipulation routines if i remember right. (Remember to take backup of the original before trying your code.) ---------------------------------------------------------------------- martin159 · 2013-09-14 13:25 Now I have: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   reg : TRegistry;   buffer: array [0..1024] of byte; begin   reg := TRegistry.Create;   // [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]DefaultConnectionSettings   try     reg.RootKey:=HKEY_CURRENT_USER;     if reg.OpenKeyReadOnly('Software\Microsoft\Windows\CurrentVersion\ Internet Settings\Connections') then     begin       reg.ReadBinaryData('DefaultConnectionSettings',buffer, 1024);     end;     // unset 9th bit ....   finally     reg.Free;   end; end;  Is it good?  How can I determine buffer size? 1024 is probably too big. How can I disable 9th bit in buffer? Thank you. ---------------------------------------------------------------------- Leledumbo · 2013-09-14 15:28 QuoteHow can I determine buffer size? reg.GetDataSize QuoteHow can I disable 9th bit in buffer?User137 has told you. No idea how? Here: Code: [Select]buffer[1] := buffer[1] and %11111110; // don't forget to write it back to the registry ---------------------------------------------------------------------- martin159 · 2013-09-15 18:33 Thank you, it change bit. But checkbox in Interent Explorer do not change status to uncheck. I export registry and manually change checkbox in Internet Explorer and export registry again. Diff is: http://www.diffchecker.com/vx1ce30x On the left side is bad settings, and on the right side is settings what I need. Can you please tell me how can I set registry to status of right side diff? How can I calculate bit operations? I need to have this 3 values in registry: "DefaultConnectionSettings"=hex:46,00,00,00,58,00,00,00,09,00,00,00,00 ,00,00,\ 00,00,00,00,00,00,00,00,00,05,00,00,00,00,00,00,00,e0,78,ab,dd,3b,b2,c e,01,\ For first value 58 command is: HEX 58 = BIN 1011000 9th bit = buffer[1] (second byte) %00001101 number at position of last 0 is first bit in second byte? buffer[1] := buffer[1] and %00001101; Have I understand it? I need set 4th "pair" to 09. For value 09 command will be: HEX 09 = BIN 1001 09 = 17th bit (third byte) buffer[2] := %00001001; // 4th "pair" Code: [Select]reg.RootKey:=HKEY_CURRENT_USER; if reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections', True) then begin reg.ReadBinaryData('DefaultConnectionSettings',buffer, reg.GetDataSize('DefaultConnectionSettings')); buffer[1] := buffer[1] and %00001101; // 4th "pair" to 58 buffer[2] := buffer[2] and %00010111; // 4th "pair" to 58 reg.WriteBinaryData('DefaultConnectionSettings',buffer, reg.GetDataSize('DefaultConnectionSettings')); end;     But it doesn't work :-( Where I have an error?