Форум "Delphi"
Паскаль, Делфи
Какие процессы использую файл?Допустим я хочу удалить DLL, но при удалении я получаю сообщение, что файл используется другими процессами. Как можно узнать перечень этих процессов? Можно ли (и как) аналогичную информацию узнать не для DLL, а для любого файла данных (например открытого какой-то программой для записи)?
|
#1 Master © 16.07.08 13:57:21
>#0 Deep © Тоже всегда интересовал этот вопрос. В венде все хорошо, но чем занимается комп без твоего ведома иной раз оч трудно узнать. Нашел тока программу Unlocker она снимает блокировки с нужного тебе файла, а если не получается предлагает сделать ряд действий: удалить, переместить, переименовать. |
#2 Mystic © 16.07.08 15:57:25
|
|
#3 Mystic © 16.07.08 15:57:51
Что-то типа такого? |
|
сенкс, главное что это возможно впринципе. А апи функцию найти -- дело техники. |
|
#5 Mystic © 16.07.08 16:48:30
Тогда делись исходником |
|
Enumerating All Modules For a Process (VS.85).aspx To determine which processes have loaded a particular DLL, you must enumerate the modules for each process. The following sample code uses the EnumProcessModules function to enumerate the modules of current processes in the system. это решение для DLL, но похоже оно будет работать только для NT-систем. Для "любых" файлов нашел следующую информацию: ObReferenceObject The ObReferenceObject routine increments the reference count to the given object. ObReferenceObject prevents deletion of the object at least until the driver subsequently calls its reciprocal, ObDereferenceObject, or closes the given object. The caller must decrement the reference count with ObDereferenceObject as soon as it is done with the object. When the reference count for an object reaches zero, a kernel-mode component can remove the object from the system. However, a driver can remove only those objects that it created, and a driver should never attempt to remove any object that it did not create. ObReferenceObjectByHandle The ObReferenceObjectByHandle routine provides access validation on the object handle, and, if access can be granted, returns the corresponding pointer to the object's body. ObReferenceObjectByHandle returns an NTSTATUS value. The possible return values include: STATUS_SUCCESS STATUS_OBJECT_TYPE_MISMATCH STATUS_ACCESS_DENIED STATUS_INVALID_HANDLE Comments A pointer to the object body is retrieved from the object table entry and returned to the caller by means of the Object parameter. If the AccessMode parameter is KernelMode, the requested access is always allowed. If AccessMode is UserMode, the requested access is compared to the granted access for the object. Only highest-level drivers can safely specify UserMode for the input AccessMode. If the call succeeds, a pointer to the object body is returned to the caller and the pointer reference count is incremented. Incrementing this count prevents the object from being deleted while the pointer is being referenced. The caller must decrement the reference count with ObDereferenceObject as soon as it is done with the object. |
|
Самый простой метод: с помощью и меню Find найти её и убить хэндл, софтина сертифицирована самим мелкософтом. |
Написать ответ |
|

#1 Master