if (currDir[0]) { browseInfo.lParam = (LPARAM) strdup(currDir); browseInfo.lpfn = &BrowseCallbackProc; } else browseInfo.lParam = 0;
void BrowseForDirectory(HWND hParent){ 	LPITEMIDLIST  itemIDList;	BROWSEINFO    browseInfo;  char          currDir[MAX_PATH];    GetCurrentDirectory(MAX_PATH, currDir);	browseInfo.hwndOwner		  = hParent;	browseInfo.pidlRoot			  = NULL;	browseInfo.pszDisplayName	= currDir;	browseInfo.lpszTitle		  = sgInstallGui.szBrowseInfo;	browseInfo.ulFlags			  = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;	browseInfo.lpfn				    = NULL;	browseInfo.lParam			    = 0;		// Show the dialog	itemIDList = SHBrowseForFolder(&browseInfo);  if (itemIDList) {    if (SHGetPathFromIDList(itemIDList, currDir)) {      InitPathDisplay(hParent, currDir, IDC_FOLDER_ICON, IDC_EDIT_DESTINATION);      SetCurrentDirectory(currDir);      lstrcpy(szTempSetupPath, currDir);    }#if 0    // XXXben LEAK!!!! but this code won't compile for some unknown reason-     // "Free is not a member of IMalloc, see objidl.h for details"    // but that's a bald-faced lie!		// The shell allocated an ITEMIDLIST, we need to free it.     // I guess we'll just leak shell objects for now :-D    LPMALLOC shellMalloc;    if (SUCCEEDED(SHGetMalloc(&shellMalloc))) {      shellMalloc->Free(itemIDList);      shellMalloc->Release();		}#endif	}}