merge ROS Shell without integrated explorer part into trunk
[reactos.git] / reactos / apps / utils / sdkparse / FixLFN.h
1 //
2 // FixLFN.h
3 //
4
5 #ifndef __FIXLFN_H
6 #define __FIXLFN_H
7
8 #include <string.h>
9 #include <tchar.h>
10 #include <shellapi.h>
11
12 inline int FixLFN ( const TCHAR* pBadFileName, TCHAR* pGoodFileName )
13 {
14 SHFILEINFO sfi;
15 TCHAR* p;
16
17 DWORD dwResult = SHGetFileInfo ( pBadFileName, 0, &sfi, sizeof(sfi), SHGFI_DISPLAYNAME );
18 if ( dwResult )
19 {
20 if ( pGoodFileName != pBadFileName )
21 _tcscpy ( pGoodFileName, pBadFileName );
22 if ( (p = _tcsrchr ( pGoodFileName, '\\' )) )
23 _tcscpy ( p+1, sfi.szDisplayName );
24 else if ( (p = _tcsrchr ( pGoodFileName, '/' )) )
25 _tcscpy ( p+1, sfi.szDisplayName );
26 else
27 _tcscpy ( pGoodFileName, sfi.szDisplayName );
28 }
29 return dwResult;
30 }
31
32 #endif//__FIXLFN_H