Dynamically bind to SHCreateItemFromParsingName

SHCreateItemFromParsingName requires a windows version >= vista.
It's only needed for the jumplist, so we'll look for it dynamically.
This commit is contained in:
OV2 2010-11-13 20:38:33 +01:00
parent 371be9b5da
commit 1c3d31828c
2 changed files with 20 additions and 7 deletions

View File

@ -180,7 +180,7 @@ FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,239,237,50,14 DEFPUSHBUTTON "OK",IDOK,239,237,50,14
PUSHBUTTON "Cancel",IDCANCEL,296,237,50,14 PUSHBUTTON "Cancel",IDCANCEL,296,237,50,14
COMBOBOX IDC_OUTPUTMETHOD,68,17,101,38,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_OUTPUTMETHOD,68,17,101,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Fullscreen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,36,48,10 CONTROL "Fullscreen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,36,48,10
CONTROL "Emulate Fullscreen",IDC_EMUFULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,75,10 CONTROL "Emulate Fullscreen",IDC_EMUFULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,75,10
CONTROL "Stretch Image",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,60,10 CONTROL "Stretch Image",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,60,10

View File

@ -4032,10 +4032,23 @@ void S9xRemoveFromRecentGames (int i)
} }
#ifdef UNICODE #ifdef UNICODE
/* OV2: We need dynamic binding to this function as it is not present in
windows versions < vista. Since the jumplist is a win7 feature this
is not a problem.
*/
typedef HRESULT (STDAPICALLTYPE *SHCIFPN) (__in PCWSTR pszPath, __in_opt IBindCtx *pbc, __in REFIID riid, __deref_out void **ppv);
HRESULT Win7_JLSetRecentGames(ICustomDestinationList *pcdl, IObjectArray *poaRemoved, UINT maxSlots) HRESULT Win7_JLSetRecentGames(ICustomDestinationList *pcdl, IObjectArray *poaRemoved, UINT maxSlots)
{ {
IObjectCollection *poc; IObjectCollection *poc;
HRESULT hr = CoCreateInstance
HMODULE S32dll = GetModuleHandle(TEXT("shell32.dll"));
SHCIFPN SHCreateIFPN = (SHCIFPN)GetProcAddress(S32dll,"SHCreateItemFromParsingName");
if(!SHCreateIFPN) {
return S_FALSE;
}
HRESULT hr = CoCreateInstance
(CLSID_EnumerableObjectCollection, (CLSID_EnumerableObjectCollection,
NULL, NULL,
CLSCTX_INPROC_SERVER, CLSCTX_INPROC_SERVER,
@ -4044,7 +4057,7 @@ HRESULT Win7_JLSetRecentGames(ICustomDestinationList *pcdl, IObjectArray *poaRem
UINT max_list = MIN(maxSlots,GUI.MaxRecentGames); UINT max_list = MIN(maxSlots,GUI.MaxRecentGames);
for (UINT i = 0; i < max_list && *GUI.RecentGames[i]; i++) { for (UINT i = 0; i < max_list && *GUI.RecentGames[i]; i++) {
IShellItem *psi; IShellItem *psi;
if(SUCCEEDED(SHCreateItemFromParsingName(GUI.RecentGames[i],NULL,IID_PPV_ARGS(&psi)))) { if(SUCCEEDED(SHCreateIFPN(GUI.RecentGames[i],NULL,IID_PPV_ARGS(&psi)))) {
hr = poc->AddObject(psi); hr = poc->AddObject(psi);
psi->Release(); psi->Release();
} }
@ -7209,10 +7222,10 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg; ofn.hwndOwner = hDlg;
ofn.lpstrFilter = TEXT("Effect Files\0*.fx\0All Files\0*.*\0\0"); ofn.lpstrFilter = TEXT("Shader Files\0*.shader\0All Files\0*.*\0\0");
ofn.lpstrFile = openFileName; ofn.lpstrFile = openFileName;
ofn.lpstrTitle = TEXT("Select Shader"); ofn.lpstrTitle = TEXT("Select Shader");
ofn.lpstrDefExt = TEXT("fx"); ofn.lpstrDefExt = TEXT("shader");
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
if(GetOpenFileName(&ofn)) { if(GetOpenFileName(&ofn)) {
@ -7228,10 +7241,10 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg; ofn.hwndOwner = hDlg;
ofn.lpstrFilter = TEXT("All Files\0*.*\0\0"); ofn.lpstrFilter = TEXT("Shader Files\0*.shader\0All Files\0*.*\0\0");
ofn.lpstrFile = openFileName; ofn.lpstrFile = openFileName;
ofn.lpstrTitle = TEXT("Select Shader"); ofn.lpstrTitle = TEXT("Select Shader");
ofn.lpstrDefExt = TEXT("*.*"); ofn.lpstrDefExt = TEXT("shader");
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
if(GetOpenFileName(&ofn)) { if(GetOpenFileName(&ofn)) {