+ WCHAR Path[MAX_PATH];
+ LPWSTR lpExtension;
+
+ /* get the extension */
+ lpExtension = wcsrchr(pContext->szTarget, '.');
+
+ if (IsExtensionAShortcut(lpExtension))
+ {
+ hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_ALL, &IID_IShellLink, (void**)&pSourceShellLink);
+
+ if (hr != S_OK)
+ return FALSE;
+
+ hr = pSourceShellLink->lpVtbl->QueryInterface(pSourceShellLink, &IID_IPersistFile, (void**)&pPersistFile);
+ if (hr != S_OK)
+ {
+ pSourceShellLink->lpVtbl->Release(pSourceShellLink);
+ return FALSE;
+ }
+
+ hr = pPersistFile->lpVtbl->Load(pPersistFile, (LPCOLESTR)pContext->szTarget, STGM_READ);
+ pPersistFile->lpVtbl->Release(pPersistFile);
+
+ if (hr != S_OK)
+ {
+ pSourceShellLink->lpVtbl->Release(pSourceShellLink);
+ return FALSE;
+ }
+
+ hr = pSourceShellLink->lpVtbl->GetPath(pSourceShellLink, Path, sizeof(Path) / sizeof(WCHAR), NULL, 0);
+ pSourceShellLink->lpVtbl->Release(pSourceShellLink);
+
+ if (hr != S_OK)
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ wcscpy(Path, pContext->szTarget);
+ }