确实太长了,不好进来!<br>这样就好了!<br>int GetNumberOfSelected(HGLOBAL hMem)<br>{<br>int ret = 0;<br>int* pInt;<br><br>if ((pInt = (int*)GlobalLock(hMem)) != NULL) {<br>ret = *pInt;<br>GlobalUnlock(hMem);<br>}<br><br>return ret;<br>}<br><br>BOOL _7FD0276A(DWORD* vp, DWORD var)<br>{<br>if (var <= vp[0])<br>return SHELL32_25((BYTE*)vp + vp[1], (BYTE*)vp + vp[var + 2]);<br><br>return FALSE;<br>}<br><br>LPCITEMIDLIST GetPIDL(HGLOBAL hGlobal, int var)<br>{<br>LPVOID vp;<br><br>if ((vp = GlobalLock(hGlobal)) != NULL) {<br>LPCITEMIDLIST pidl = _7FD0276A(vp, var);<br>GlobalUnlock(hGlobal);<br>return pidl;<br>}<br><br>return NULL;<br>}<br><br>BOOL GetTargetInfo(HGLOBAL hGlobal, int var, char FilePath[MAX_PATH], WIN32_FIND_DATA* lpFindData)<br>{<br>LPCITEMIDLIST pidl;<br><br>PathName[0] = '/0';<br>if ((pidl = GetPIDL(hGlobal, var)) != NULL) {<br>if (SHGetPathFromIDList(pidl, FilePath)) {<br>if (lpFindData) {<br>if ((hFff = FindFirstFile(FilePath, lpFindData)) == INVALID_HANDLE_VALUE)<br>memset(lpFindData, 0, sizeof(WIN32_FIND_DATA));<br>else<br>CloseHandle(hFff);<br>}<br><br>SHELL32_155_FreePidl(pidl);<br>return TRUE;<br>}<br>else {<br>SHELL32_155_FreePidl(pidl);<br>return FALSE;<br>}<br>}<br><br>return FALSE;<br>}<br><br>int CreatePropDialog(p1, pfn, IDataObject* pDataObj)<br>{<br>FORMATETC formatetc;<br>STGMEDIUM medium;<br>PROPSHEETPAGE psp;<br>HLOCAL hLocal;<br>HGLOBAL hGlobal;<br>WIN32_FIND_DATA ffd;<br>HPROPSHEETPAGE hPsp;<br>char PathName[MAX_PATH];<br><br>BOOL var_4;<br>int var_8;<br><br>formatetc.lindex = -1;<br>formatetc.cfFormat = gcfFormat;<br>formatetc.ptd = 0;<br>formatetc.dwAspect = 1;<br>formatetc.tymed = TYMED_HGLOBAL;<br><br>var_4 = FALSE;<br>var_8 = 0;<br><br>if (FAILED(pDataObj->GetData(&formatetc, &medium)))<br>return FALSE;<br><br>PathName[0] = 0;<br>psp.hInstance = ghModule;<br>psp.dwSize = 952; //NOT sizeof(psp); !!!<br>psp.dwFlags = PSP_USECALLBACK; //0x80;<br>psp.pfnCallback = PropCallback;<br>var_2a0 = 1;<br>var_3a8 = 0;<br>var_34 = 0;<br>var_30 = 0;<br><br>hGlobal = medium.hGlobal;<br>if (hGlobal) {<br>hLocal = LocalAlloc(LPTR, GlobalSize(hGlobal));<br>if (hLocal) <br>memmove(hLocal, hGlobal, GlobalSize(hGlobal));<br>}<br>else<br>hLocal = NULL;<br><br>if (GetNumberOfSelected(hGlobal) == 1) { // else 7fd05dd5<br>if (GetTargetInfo(hGlobal, 0, &PathName, &ffd)) { // else 7fd05d9f<br>psp.pfnDlgProc = ConventionalDlgProc;<br>psp.pResource = MAKEINTRESOURCE(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY? 1044 : 1041);<br>if ((hPsp = CreatePropertySheetPage(&psp)) != NULL) { // else loc_7FD05D9F<br>if (pfn(hPsp, p1)) { // else loc_7FD05E07<br>var_4 = 1;<br>if (CreateShortcutPage(hGlobal, &PathName, pfn, p1))<br>var_8 = 2;<br>CreateVersionPage(&PathName, pfn, p1);<br>}<br>else // loc_7FD05E07<br>DestroyPropertySheetPage(hPsp);<br>}<br>}<br>}<br>else { // loc_7FD05DD5<br>psp.pResource = MAKEINTRESOURCE(1043);<br>psp.pfnDlgProc = MultiSelDlgProc;<br>if ((hPsp = CreatePropertySheetPage(&psp)) != NULL) { // else loc_7FD05D9F<br>if (pfn(hPsp, p1))<br>var_4 = 1;<br>else<br>DestroyPropertySheetPage(hPsp);<br>}<br>}<br><br>// loc_7FD05D9F<br>_7FCC6204(&medium);<br>if (!var_4 && hLocal)<br>LocalFree(hLocal);<br><br>return var_8;<br>}<br><br>BOOL IsLnkFile(char* PathName)<br>{<br>if (PathName)<br>return lstrcmpi(PathFindExtension(PathName), ".lnk"
== 0;<br><br>return FALSE;<br>}<br><br><br>HRESULT CreateShellInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv)<br>{<br>CShellFactory* pCShellFactory;<br>HRESULT hr;<br><br>if (pUnknownOuter)<br>return CLASS_E_NOAGGREGATION;<br><br>pCShellFactory = new CShellFactory;<br><br>if (pCShellFactory == NULL)<br>return E_OUTOFMEMORY;<br><br>pCShellFactory->m_cRef = 1;<br>pCShellFactory->Init();<br><br>hr = pCShellFactory->CreateInstance(iid, ppv);<br><br>pCShellFactory->Release();<br><br>return hr;<br>}<br><br>typedef struct FindTargetData<br>{<br>HGLOBAL hGlobal; // 0<br>IShellLinkA* pIShellLink; // 4<br>int hDlgWnd; // 8<br>int dwc; // c<br>int dw10; // 10<br>int dw14; // 14<br>int dw18; // 18<br>char Path[MAX_PATH]; // 1c<br>};<br><br>BOOL CreateShortcutPage(HGLOBAL hGlobal, char PathName[MAX_MATH], pfn, p1)<br>{<br>PROPSHEETPAGE psp;<br>IShellLink* pIShellLink;<br>FindTargetData* pFtd;<br>HPROPSHEETPAGE hPsp;<br><br>if (IsLinkFile(PathName) && <br>SUCCEEDED(CreateShellInstance(NULL, IID_IShellLink, &pIShellLink))) <br>{ // else loc_7FD040F6<br>pFtd = (FindTargetData*) LocalAlloc(LPTR, sizeof(FindTargetData));<br>if (pFtd != NULL) { // else loc_7FD040ED<br>psp.hInstance = ghModule;<br>psp.dwSize = sizeof(PROPSHEETPAGE);<br>psp.dwFlags = PSP_USECALLBACK;<br>psp.pResource = MAKEINTRESOURCE(1040);<br>psp.pfnDlgProc = ShortcutDlgProc;<br>psp.pfnCallback = CallbackProc;<br>psp.lParam = pFtd;<br>lstrcpyn(pFtd->Path, PathName, MAX_PATH);<br>pFtd->dw14 = -1;<br>pFtd->hGlobal = hGlobal;<br>pFtd->pIShellLink = pIShellLink;<br>if ((hPsp = CreatePropertySheetPage(&psp)) != NULL) {<br>if (pfn(hPsp, p1))<br>return TRUE;<br>DestroyPropertySheetPage(hPsp);<br>}<br>LocalFree(pFtd);<br>}<br>pObj->Release();<br>}<br><br>return FALSE;<br>}