![]() |
file name from remote proc |
Post Reply
|
Page 12> |
| Author | |
majkinetor
Groupie
Joined: 17 April 2006 Location: Yugoslavia Online Status: Offline Posts: 42 |
Post Options
Quote Reply
Topic: file name from remote procPosted: 15 May 2006 at 8:22am |
|
Nope... that will not help... 1st func is for FileDirInfo and second is overkill.
Look at this:
It seems that this is FULL path :) Anyway, I'll keep this function since it is much faster then NTQO and it doesn't block my app (probably less memory intensive). Thx EP_X0FF for your help. That will be it. No more question here. Stay good, and if you need any help in computer fields, drop me a line. homepage Edited by majkinetor - 15 May 2006 at 8:38am |
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Post Options
Quote Reply
Posted: 15 May 2006 at 7:04am |
|
FileBothDirectoryInformation class?
FileAllInformation? |
|
![]() |
|
majkinetor
Groupie
Joined: 17 April 2006 Location: Yugoslavia Online Status: Offline Posts: 42 |
Post Options
Quote Reply
Posted: 15 May 2006 at 3:27am |
|
Hej there.
When I am using NtQueryObject I get names OK but for some reason application can't exit ! I put breakpoint at last line of main function (return 0) and it is reached everytime, but after that, applicatin doesn't close itself, and it can't be killed. I had to rename project output on every compile to avoid restarting computer every 5 minutes. I used this kind of code to debug: print(1), NTQO(), print(2); And I got output like this: 12 12 112 12 112 ... So, threead is terminated if NTQO hangs but this function blocks my code on some other level.... I didn't find solution to this, so I switched to other function, NtQueryInformationFile. Now application doesn't hang but another quite interesting problem arised. It doesn't return device location, but raltive path: instead \Device\HarddiskVolumeX\Windows\System32 it give me \Windows\System32 only. I looked into code of guy who wrote WhoUses.exe on CodeGuru and he was using the same procedure to get filename, but he got complite names ?! This is Visual Studio picture that will clarify this. U can see that lpBuffer doesn't have device information. This is not so big problem but hard disk could have the same paths on different partitions locked at the same time. Visual Studio Debug Screenshot |
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Post Options
Quote Reply
Posted: 12 May 2006 at 4:16am |
Anyway glad to help you. |
|
![]() |
|
majkinetor
Groupie
Joined: 17 April 2006 Location: Yugoslavia Online Status: Offline Posts: 42 |
Post Options
Quote Reply
Posted: 12 May 2006 at 3:19am |
|
I don't know what is going on here, since when my console application that I am using for test hang, I can not delete it for very long period of time (it is up for more then 20 minutes now...). TaskInfo & Proc Exp can not kill it also.
You are right, that is too big project for simple plugin, it already took me much time to come to this stage. Anyway you were of great help and I thank you for that. Your english is fine by me.
|
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Post Options
Quote Reply
Posted: 11 May 2006 at 11:55am |
|
Yes it will decrease performance. Each thread will decrease performance and your plugin will works very slow and probably use more memory. As you know NtQueryObjects sometimes hungs. It happens when it trying to get name of NamedPipe object. So for this reason I think you are creating new threads. But in forum-thread "Enumerate opened files" we have not get solution for this "hung" problem. It is known that under Ring0 (Kernel Mode) everything works fine (look on Process Explorer). But for this solution you need to create driver and this I think is too much for some simple program as "tc plugin". Hope this small information on bad english
will help you.
Regards. |
|
|
Ring0 - the source of inspiration
|
|
![]() |
|
majkinetor
Groupie
Joined: 17 April 2006 Location: Yugoslavia Online Status: Offline Posts: 42 |
Post Options
Quote Reply
Posted: 11 May 2006 at 11:41am |
|
Thank you EP_X0FF.
I switched to NtQO function and everything is ok up to the part where it hangs for long period of time. I have to open thread to execute this function and kill it after some short time. I have to ask for opinion here if you have time: Since I am trying to create Total Commander so called content plugin this needs to be fast, because it will be called for each file in the directory. The plugin is supouse to return information about file's lock status and to return string containing names of applications which hold the lock. I am caching information on the first file (I create a snapshot of all open files in the system) and look into cache on all other subsequent files. Therefore, above procedure will be executed only once, but it still have to be fast to alow TC to function normaly (lets say, everything up to 2 seconds should be fine). I am concerned here how big impact on procedure speed will have creating new thread for every file handle in the system (on my system, currently > 1000) thx |
|
![]() |
|
EP_X0FF
Senior Member
Joined: 08 March 2006 Location: Russian Federation Online Status: Offline Posts: 4753 |
Post Options
Quote Reply
Posted: 11 May 2006 at 8:50am |
|
Grant more privilegies to OpenProcess? Why not use NtQueryObject - Object Name Information class?
|
|
![]() |
|
majkinetor
Groupie
Joined: 17 April 2006 Location: Yugoslavia Online Status: Offline Posts: 42 |
Post Options
Quote Reply
Posted: 11 May 2006 at 8:47am |
|
This is how I declared those functions:
Edited by majkinetor - 11 May 2006 at 8:49am |
|
![]() |
|
majkinetor
Groupie
Joined: 17 April 2006 Location: Yugoslavia Online Status: Offline Posts: 42 |
Post Options
Quote Reply
Posted: 11 May 2006 at 8:46am |
|
then after fixing handle problem:
The specified request is nota valid operation for the target device |
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |