/* get the search path for the current module; helper for OpenFile16 */ static char *get_search_path(void) { UINT len; char *ret, *p, module[OFS_MAXPATHNAME]; module[0] = 0; if (GetCurrentTask() && GetModuleFileName16( GetCurrentTask(), module, sizeof(module) )) { if (!(p = strrchr( module, '\\' ))) p = module; *p = 0; } len = (2 + /* search order: first current dir */ GetSystemDirectory16( NULL, 0 ) + 1 + /* then system dir */ GetWindowsDirectoryA( NULL, 0 ) + 1 + /* then windows dir */ strlen( module ) + 1 + /* then module path */ GetEnvironmentVariableA( "PATH", NULL, 0 ) + 1); /* then look in PATH */ if (!(ret = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL; strcpy( ret, ".;" ); p = ret + 2; GetSystemDirectory16( p, ret + len - p ); p += strlen( p ); *p++ = ';'; GetWindowsDirectoryA( p, ret + len - p ); p += strlen( p ); *p++ = ';'; if (module[0]) { strcpy( p, module ); p += strlen( p ); *p++ = ';'; } GetEnvironmentVariableA( "PATH", p, ret + len - p ); return ret; }
/************************************************************************* * ExtractAssociatedIcon [SHELL.36] * * Return icon for given file (either from file itself or from associated * executable) and patch parameters if needed. */ HICON16 WINAPI ExtractAssociatedIcon16(HINSTANCE16 hInst, LPSTR lpIconPath, LPWORD lpiIcon) { HICON16 hIcon; WORD wDummyIcon = 0; TRACE("\n"); if(lpiIcon == NULL) lpiIcon = &wDummyIcon; hIcon = ExtractIcon16(hInst, lpIconPath, *lpiIcon); if( hIcon < 2 ) { if( hIcon == 1 ) /* no icons found in given file */ { char tempPath[0x80]; UINT16 uRet = FindExecutable16(lpIconPath,NULL,tempPath); if( uRet > 32 && tempPath[0] ) { strcpy(lpIconPath,tempPath); hIcon = ExtractIcon16(hInst, lpIconPath, *lpiIcon); if( hIcon > 2 ) return hIcon; } else hIcon = 0; } if( hIcon == 1 ) *lpiIcon = 2; /* MSDOS icon - we found .exe but no icons in it */ else *lpiIcon = 6; /* generic icon - found nothing */ GetModuleFileName16(hInst, lpIconPath, 0x80); hIcon = LoadIconA( hInst, MAKEINTRESOURCEA(*lpiIcon)); } return hIcon; }