예제 #1
0
HRESULT WINAPI HookSHGetSpecialFolderLocation(HWND hwndOwner,
											  int nFolder,
											  LPITEMIDLIST *ppidl)								
{  
	int folder = nFolder & 0xff;
	if ( CSIDL_APPDATA == folder || CSIDL_LOCAL_APPDATA == folder )
	{  
		LPITEMIDLIST pidlnew = NULL;
		HRESULT result = 0L;
		if ( appdata_path[0] == L'\0' )
		{
			return TrueSHGetSpecialFolderLocation(hwndOwner, nFolder, ppidl);
		}
		if (CSIDL_LOCAL_APPDATA == folder)
		{
			result = SHILCreateFromPath( localdata_path, &pidlnew, NULL);
		}
		else
		{
			result = SHILCreateFromPath(appdata_path, &pidlnew, NULL);
		}
		if (result == S_OK)
		{
			*ppidl = pidlnew;
			return result;
		}
	}
	return TrueSHGetSpecialFolderLocation(hwndOwner, nFolder, ppidl);
}
예제 #2
0
ItemIDList ItemIDList::FromPath(const wchar_t* path)
{
	ItemIDList result;

	if (FAILED(SHILCreateFromPath(path, &result, NULL)))
		throw std::invalid_argument("Failed to convert the specified path");

	return result;
}
예제 #3
0
파일: main.cpp 프로젝트: korha/Portablize
EXPORT HRESULT WINAPI SHGetSpecialFolderLocationStub(HWND, int, PIDLIST_ABSOLUTE *ppidl)
{
    return SHILCreateFromPath(g_wBuf, ppidl, nullptr);
}