app := Process(2036);
with app.Handles do
for i1:=0 to ItemCount do
s1 := s1 + #13#10 + Items[i1].KernelObj.ObjName;
MessageBox(0, pchar(s1), 'kernel objects', 0);
my app freezes and CPU is at 100% for 2-3 seconds. is it possible to avoid this?
@madshi,
I know of no API that allows you to map a symbolic link to a logical drive letter. But, if you call QueryDosDevice() with the first param as nil you will receive a buffer of null terminated device names including all logical devices (a-z drive letters and so on). After that just run a loop and use the logical names to get their own respective symbolic link names (\Device\whatever).
I had to do it a few months ago so here is my code, hope it helps.
Procedure MapSymbolicLinks(const LV: TListView);
const mem_sz = 16000;
var
p: PChar;
sz, i: cardinal;
buf: array [0..MAX_PATH] of char;
sl: TStringList;
begin
sl := TStringList.Create();
try
GetMem(p, mem_sz);
ZeroMemory(@buf, sizeof(buf));
sz := QueryDosDevice(nil, @p^, mem_sz);
for i := 1 to sz do
if p[i] = #0 then
p[i] := #10;
sl.CommaText := p;
lv.Items.BeginUpdate();
for i := 0 to sl.count-1 do
begin
with
Lv.Items.Add() do
begin
Caption := sl[i];
QueryDosDevice(@PChar(sl[i])^, @buf, sizeof(buf));
with Subitems do
Add(buf);
end;
end;
finally
FreeMem(p);
sl.Free;
Lv.Items.EndUpdate();
end;
end;