Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Which API is called when open a directory?

Which API is called when open a directory?

Scheduled Pinned Locked Moved Mobile
jsonhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nguyenvodich
    wrote on last edited by
    #1

    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 !

    C 1 Reply Last reply
    0
    • N nguyenvodich

      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 !

      C Offline
      C Offline
      Christopher Fairbairn
      wrote on last edited by
      #2

      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

      N 1 Reply Last reply
      0
      • C 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

        N Offline
        N Offline
        nguyenvodich
        wrote on last edited by
        #3

        Thank you very much,Christopher Fairbairn! I think that is all I need.

        Nothing Is Impossible !

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups