title: CreateFile GetFileTIme SetFileTime
body: <p>I'm having trouble using GetFileTime and SetFileTime 
  when it comes to directories.  Specifically I think my problem is
  that I am new to the WinAPI and I don't think I'm getting the
  HANDLE correctly.</p>
  
  <p>There are 2 scenarios.  </p>
  
  <p>In the first, I just need a handle to get the file or directory
  timestamps (create,access,mod).  I'd like to make this handle in a safe and flexible way.
  Don't want to be too generous in the parameters.</p>
  
  <p>In the second, I need a handle that will allow me to modify the file or direcotry
  timestamps.  I'd also like to create this handle with the minimum rights but in flexible and dependable way.  </p>
  
  <p>By flexible I mean that in both scenarios I need the code to work both localy, in a network share, and in a multi-threaded app.  The multi-threaded part is not  necessary because my app will not make multiple handles on the file/dir but it is possible that some other app running in the background will.</p>
  
  <pre><code>//QUESTION 1:
  //I do this when I just need a handle to **GET** some attributes like dates.
  //(here I just need a handle to get info I am not modding the item).
  //Am I using the correct params if I need it to work in a 
  //local + networked environment and also in a multi-threaded app???
  h1 = CreateFile(itemA, GENERIC_READ, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
  if (h1 == INVALID_HANDLE_VALUE){
  
      return 0;
  }
  //QUESTION 2:
  //The above works for local files but not local dirs.
  //How can I get the above to work for dirs? (Same environment considerations).
  
  
  //QUESTION 3:
  //I do this when I just need a handle to ***SET*** some attributes (like timestamps).
  //(here I need a handle that allows me to modd the items timestamp).
  //Am I using the correct params if I need it to work in a 
  //local + networked environment and also in a multi-threaded app???
  hItemB = CreateFile(itemB, FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
  if (hItemB == INVALID_HANDLE_VALUE){
      return 0;
  }
  //QUESTION 4:
  //The above works for local files but not local dirs.
  //How can I get the above to work for dirs? (Same environment considerations).
  </code></pre>