Thread: possible reasons for invalid handle from CreateFile

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    188

    possible reasons for invalid handle from CreateFile

    hello, the following is the code i use to create a file handle:
    Code:
    ::CreateFile(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    like all bugs, it works on my machine and my test environment, but doesn't work at the customer's site. GetLastError() is telling me that the handle is invalid. what are some things to look for in troubleshooting this error?

    thanks.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    What is your test environment and how is it different from the customer's? I assume you are running a release version at the customers? Did you also run a release version in your test environment? Are you using any ASSERT statements that contain anything critical to the file opening, since ASSERTS aren't available during RELEASE builds.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with setting text into LTEXT using Window Handle
    By jasperleeabc in forum Windows Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Getting other processes class names
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2008, 04:02 PM
  3. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  4. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM