![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
как определить владельца мьютекса (mutex owner) [D7, WinXP]
intlex © (2009-10-06 19:09:00)по сабжу,
пробовал NtQueryObject, но пока безуспешно, может кто поможет?
intlex (2009-10-07 16:25:00) [1]спасибо, так получилось)
clickmaker (2009-10-07 16:14:00) [2]var sd: PSecurityDescriptor;
GetKernelObjectSecurity(Mutex, OWNER_SECURITY_INFORMATION, nil, 0, len);
sd := AllocMem(len);
GetKernelObjectSecurity(Mutex, OWNER_SECURITY_INFORMATION, sd, len, len);
а так?
intlex (2009-10-07 15:09:00) [3]
InitializeSecurityDescriptor(@sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(@sd, True, nil, False);
sa.nLength := SizeOf(TSecurityAttributes);
sa.lpSecurityDescriptor := @sd;
sa.bInheritHandle := False;
Mutex := CreateMutex(@sa, False, MutexName);
if (Mutex = 0) then ...;
if GetLastError = ERROR_ALREADY_EXISTS) then
begin
GetKernelObjectSecurity(Mutex, OWNER_SECURITY_INFORMATION, @sd, SizeOf(TSecurityDescriptor), l);
//GetSecurityDescriptorOwner(@sd, MData, b);
получается sd.Owner = nil, MData = nil
если предварительно заполнить sd.Owner := Pointer(GetCurrentProcessId),
то CreateMutex возвращает 0.
наверное, я что-то не понимаю))
clickmaker (2009-10-07 12:14:00) [4]GetKernelObjectSecurity(MutexHandle, OWNER_SECURITY_INFORMATION, ... ?