Createfile file name error

mhubel

New Member
We have a "simple" call to CreateFile:
flashfileHandle=CreateFile((LPCWSTR)working_path,FILE_READ_DATA|FILE_WRITE_DATA,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
which apparently had been working in Vista (32 bit) up to a few weeks ago. Now it is failing in our user's systems. It is still working properly in XP. Apparently this is related to some update that Microsoft did with an automatic update.
The return is either error 2(FILE NOT FOUND) or 123 (Invalid Name).

This code is in a "terminal module" compiled and linked under Visual studio 2005 SP1 with the test being done at command line level.

Using exactly the same name (working_path) in fopen_s works.
I have tried to set the administration rights to administrator and turning "user accounts->turn user account control on or off" off with no effect.
Eliminating FILE_WRITE_DATA does not help.
Any idea what has happened and how to fix it?
 

My Computer

It seems that lately everything needs "elevated privileges" or "run as administrator" to work properly.

This condition is set in the file properties of the program you are running. It is a checkbox on the compatibility tab.
 

My Computer

System One

  • Manufacturer/Model
    Custom - Built Myself
    CPU
    E8400 Core 2 Duo @ 9 X 400
    Motherboard
    ASUS P5E3 Deluxe WiFi X38
    Memory
    4GB OCZ Platinum OCZ3P13332GK
    Graphics Card(s)
    Gigabyte Radeon HD RX3850 775MHZ 512MB 1.4GHZ GDDR3
    Sound Card
    On Board
    Monitor(s) Displays
    Dell SP2208WFP
    Screen Resolution
    1680 X 1050
    Hard Drives
    1 X 640GB 7200 Western Digital
    2 X 500GB 7200 Seagate Barracuda
    All with cooling fans
    PSU
    ENERMAX 1000W Galaxy DXX
    Case
    CoolerMaster CM690
    Cooling
    Zalman CNPS9700 NT / 4 X 120mm / 1 X 80mm Case Fans
    Keyboard
    Microsoft Natural Ergonomic Comfort 4000
    Mouse
    Microsoft Comfort Optical 3000
    Internet Speed
    10mbps down / 1mbps up - Shaw Xtreme
    Other Info
    Lg GGC-H20L BLU-RAY HD-DVD Reader BD-ROM DVD+-RW 16X8X6 DL 4X

    Scythe Multi-Format Card Reader / Floppy Drive
Jim,
Unfortunately, we already tried setting the application compatibility permissions to "administrator" with the check box. We also tried running it in XP compatibility mode. It was a significant surprise that even that didn't work.
 

My Computer

The problem has been solved. It was that the path being sent to CreatFile (which is a long character string of unicode) was invalid but XP and the earlier updates to Vista had been tolerating it and doing the intended file operation. With the update in Vista, the string was no longer tollerated.
 

My Computer

Back
Top