c++ - IShellLink GetArguments is only returning executable -


I have a cover application that needs to publish all XP mode applications; All of these are in one folder, and I am using QT to get all the .lnk files.

This works a little bit - the problem is that to stop all virtual PC applications to stop 32, the virtual machine and / or its app (like % SystemRoot% \ system32 \ Rundll32.exe% SystemRoot% \ system32 \ VMCPropertyHandler.dll, launchvimal "windows xp mode" "some_id" some_name "), and therefore I need to read the full target.

The MSDN docs should read a IShellLink on GetArguments () . This data should be returned - but this only ever rundll32.exe < / Code>, and never with command line data. GetPath () does this, as it is expected, but there is no other method for calling me which may be able to get the data I need.

I have created a test shortcut separately in logic style ( / param , -param and plain param ), but Nothing is a difference. This is not just a virtual PC link - it applies to all shortcuts.

Here is the function code:

  QString GetShortcutTarget (const char * shortcut) {IShellLink * psl = faucet; IPersistFile * ppf = NULL; Wchar_t wsz [MAX_PATH]; Wchar_t targets [MAX_PATH * 4]; // w / e QString retval; If (Multibytovider (CP_ACP, 0, shortcut, -1, WSJ, MAX_PATH) == 0) Goto cleaning; If (failed (CoCreateInstance (CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (zero **) and PSL))) Goto cleanup; If (FAILED (psl-> Query Interface (IID_IPersistFile, (Zero **) and PPF)) Goto Cleansing; If (FAILED (ppf-> gt; load (wsz, STGM_READ)) Geto cleanup; // GetPath () and GetArguments return the same // (if not! = Psl-> GetPath (target, _countof (target) , Nullptr, 0)) (NOERROR! = Psl- & gt; GetArguments (target, _countof goal))) Goto cleanup; Retval = QString :: fromWCharArray (Target); Cleanup: If (PPF) PPF-> Release (); If (psl) psl-> Release (); Return return; }  Edit          P> 
  #include & lt; Objidl.h & gt; // Include IPSerfile file & lt; Schlobaz H & gt; // The other link related code is a constructor and destroyer elsewhere ___________________________________________________________________________________________________________________ (Yes, already called!):  
  co-initial (null); ... CoUninitialize (); Qt is expected that nothing should be done with it, as COM is definitely opening .lnk and is reading ..   

I searched for the problem - the input shortcut was .lnk but not the full file path; Because the shortcut was not located in my current directory, it failed to load it naturally.

I had Qt running on full path, but I was only searching for the file name targeting. I modified my last call somewhere else:

  file_info.fileName ()  

to:

  file_info. AbsoluteFilePath)  

And it has fixed this issue!


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -