Which API is called when open a directory?
-
Which API is called when open a directory in WinCE ? I tried to monitor CreateFileW API to find out if it is used for opening a directory but It's not. HANDLE _CreateFileHook( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { HANDLE H=INVALID_HANDLE_VALUE; if (wcsstr(lpFileName,L"My Documents")!=NULL) { MessageBox(GetForegroundWindow(),L"???",NULL,MB_OK); } else H=((t_CreateFile*)Old)(lpFileName,dwDesiredAccess,dwShareMode,lpSecurityAttributes,dwCreationDisposition,dwFlagsAndAttributes,hTemplateFile); return H; } When i clicked on My Documents directory,It didn't do anything! But when I opened one file on this directory, the MessageBox appeared. I don't know which API I must to intercept in this case.( to prevent from opening a directory).:confused: Help me !!! Thanks !
Nothing Is Impossible !
-
Which API is called when open a directory in WinCE ? I tried to monitor CreateFileW API to find out if it is used for opening a directory but It's not. HANDLE _CreateFileHook( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { HANDLE H=INVALID_HANDLE_VALUE; if (wcsstr(lpFileName,L"My Documents")!=NULL) { MessageBox(GetForegroundWindow(),L"???",NULL,MB_OK); } else H=((t_CreateFile*)Old)(lpFileName,dwDesiredAccess,dwShareMode,lpSecurityAttributes,dwCreationDisposition,dwFlagsAndAttributes,hTemplateFile); return H; } When i clicked on My Documents directory,It didn't do anything! But when I opened one file on this directory, the MessageBox appeared. I don't know which API I must to intercept in this case.( to prevent from opening a directory).:confused: Help me !!! Thanks !
Nothing Is Impossible !
Hi, Have you looked into writing a file system filter as discussed in the Windows CE Team Blog in this posting http://blogs.msdn.com/ce_base/archive/2005/12/01/499052.aspx[^]? Directories are not opened, but searched. You would have to hook functions such as FindFirstFile et al which are called when an application wants to obtain a list of files within a specified directory. If you are wanting to "hide" or "remove" a directory. You would need to hook functions such as FindFirstFile to filter out the enteries related to the directory you want to hide. You would also need to hook CreateFile to stop the user being able to open any files within this directory (if they explictly type in a path somewhere). hope this helps, Christopher Fairbairn
-
Hi, Have you looked into writing a file system filter as discussed in the Windows CE Team Blog in this posting http://blogs.msdn.com/ce_base/archive/2005/12/01/499052.aspx[^]? Directories are not opened, but searched. You would have to hook functions such as FindFirstFile et al which are called when an application wants to obtain a list of files within a specified directory. If you are wanting to "hide" or "remove" a directory. You would need to hook functions such as FindFirstFile to filter out the enteries related to the directory you want to hide. You would also need to hook CreateFile to stop the user being able to open any files within this directory (if they explictly type in a path somewhere). hope this helps, Christopher Fairbairn
Thank you very much,Christopher Fairbairn! I think that is all I need.
Nothing Is Impossible !