locked
How to get local app data path from a winrt "C" api

    Question

  • Hi,

    I am trying to port code from win32 to winrt and I am replacing CreateFile, ReadFile and so on by corresponding api
    CreateFile2, ReadFileEx, ....

    The problem with these api is we can only have a write access inside local app data and roaming folders but how can we get
    these path from a "C" api ?
    I am looking for something like SHGetFolderPath(LOCAL_APP_DATA, ...), is there anything like that ?

    Thanks

    Friday, June 15, 2012 12:07 PM

Answers

  • Hi Vincent,

    There is no C style API for this. You'll need to use the ApplicationData class, which is easily called from C++/Cx. If you want to use C you can call this via the underlying COM interfaces from C, but I wouldn't recommend doing so. For porting purposes I would write a layer which you could access from C but which internally called into the Windows Runtime with C++/Cx.

    --Rob

    • Marked as answer by Jesse Jiang Monday, June 18, 2012 11:43 AM
    Friday, June 15, 2012 12:14 PM
    Owner

All replies

  • Hi Vincent,

    There is no C style API for this. You'll need to use the ApplicationData class, which is easily called from C++/Cx. If you want to use C you can call this via the underlying COM interfaces from C, but I wouldn't recommend doing so. For porting purposes I would write a layer which you could access from C but which internally called into the Windows Runtime with C++/Cx.

    --Rob

    • Marked as answer by Jesse Jiang Monday, June 18, 2012 11:43 AM
    Friday, June 15, 2012 12:14 PM
    Owner
  • Hi !

    Sorry to jump in with my question.

    I am also trying to port some win32 API which is in C  to Winrt .

    Is there any link where i can get some link to sample code.

    Also , is there any impact on C++ constructs like malloc, memset etc with the porting ?

    -Sravan Vurapalli

    Monday, November 19, 2012 10:08 AM