Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the PendingFileRenameOperations count?
    primarykey
    data
    text
    <p>I would like to get the count of PendingFileRenameOperations, I have the following code below, but I keep getting a count higher then the actual number set in the registry.</p> <p>For example, with the function below I get a count of (5) but there is only (2) pending or I get a count of (11) but there is only (5) pending.</p> <p>Any help would be greatly appreciated.</p> <pre><code>function GetPendingFileRenameCount(): Integer; const PendingFileRenameOperationsKey = 'SYSTEM\CurrentControlSet\Control\Session Manager'; PendingFileRenameOperationsName = 'PendingFileRenameOperations'; var Reg: TRegistry; DataSize: Integer; Buffer: string; begin Reg := TRegistry.Create; try Reg.RootKey := HKEY_LOCAL_MACHINE; Result := 0; if Reg.OpenKeyReadOnly(PendingFileRenameOperationsKey) then begin DataSize := Reg.GetDataSize(PendingFileRenameOperationsName); SetLength(Buffer, DataSize); Reg.ReadBinaryData(PendingFileRenameOperationsName, Buffer[1], DataSize); while (Pos(#0, Buffer) &gt; 0) do begin Result := Result + 1; Buffer := Copy(Buffer, Pos(#0, Buffer) + 1, Length(Buffer)); end; end; finally Reg.Free(); end; end; </code></pre> <h3>UPDATE</h3> <p>I should have mentioned I'm trying to get the count of the pending files to be deleted.</p> <h3>UPDATE TWO</h3> <p>Here's what I have in my registry:</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5\index.dat#0#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5\index.dat#0#0</p> <p>\??\Z:\Local Settings\Temp\etilqs_vTXZjJASQeyi046Mjjig#0#0</p> <p>\??\Z:\Local Settings\Temp\etilqs_av9VVc5fw7Za76J12NTc#0#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5#0#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5#0#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5\index.dat#0 !\??\z:\test.fil#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5#0#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5\index.dat#0 !\??\X:\test.fil#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5#0#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5\index.dat#0 !\??\X:\test.fil#0</p> <p>\??\Z:\Local Settings\Internet Files\Content.IE5#0 !\??\X:\test.fil#0#0</p> <p>The lines with the double null at the end are the files that will be deleted on the next reboot, Those are the ones I would like to get the count of (except the very last double null). I'm really not sure how to parse this to get what I'm looking for.</p> <p>Would it be as simple as just adding another #0 to the Pos function?</p> <pre><code>while (Pos(#0#0, Buffer) &gt; 0) do begin Result := Result + 1; Buffer := Copy(Buffer, Pos(#0#0, Buffer) + 1, Length(Buffer)); end; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload