============================================================================= FindIniFile()
| 5096 | // |
| 5097 | // |
| 5098 | int CheckIniFile ( LPWSTR lpszFile, LPCWSTR lpszModule ) |
| 5099 | { |
| 5100 | WCHAR tchFileExpanded[MAX_PATH]; |
| 5101 | WCHAR tchBuild[MAX_PATH]; |
| 5102 | ExpandEnvironmentStrings ( lpszFile, tchFileExpanded, COUNTOF ( tchFileExpanded ) ); |
| 5103 | if ( PathIsRelative ( tchFileExpanded ) ) { |
| 5104 | // program directory |
| 5105 | lstrcpy ( tchBuild, lpszModule ); |
| 5106 | lstrcpy ( PathFindFileName ( tchBuild ), tchFileExpanded ); |
| 5107 | if ( PathFileExists ( tchBuild ) ) { |
| 5108 | lstrcpy ( lpszFile, tchBuild ); |
| 5109 | return ( 1 ); |
| 5110 | } |
| 5111 | // %appdata% |
| 5112 | if ( S_OK == SHGetFolderPath ( NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild ) ) { |
| 5113 | PathAppend ( tchBuild, tchFileExpanded ); |
| 5114 | if ( PathFileExists ( tchBuild ) ) { |
| 5115 | lstrcpy ( lpszFile, tchBuild ); |
| 5116 | return ( 1 ); |
| 5117 | } |
| 5118 | } |
| 5119 | // general |
| 5120 | if ( SearchPath ( NULL, tchFileExpanded, NULL, COUNTOF ( tchBuild ), tchBuild, NULL ) ) { |
| 5121 | lstrcpy ( lpszFile, tchBuild ); |
| 5122 | return ( 1 ); |
| 5123 | } |
| 5124 | } else if ( PathFileExists ( tchFileExpanded ) ) { |
| 5125 | lstrcpy ( lpszFile, tchFileExpanded ); |
| 5126 | return ( 1 ); |
| 5127 | } |
| 5128 | return ( 0 ); |
| 5129 | } |
| 5130 | int CheckIniFileRedirect ( LPWSTR lpszFile, LPCWSTR lpszModule ) |
| 5131 | { |
| 5132 | WCHAR tch[MAX_PATH]; |
no outgoing calls
no test coverage detected