| 1 | #ifndef __SHLFILEOP_H__
 | 
|---|
| 2 | #define __SHLFILEOP_H__
 | 
|---|
| 3 | #define IsAttribFile(x) (!(x == -1) && !(x & FILE_ATTRIBUTE_DIRECTORY))
 | 
|---|
| 4 | #define IsAttribDir(x)  (!(x == -1) && (x & FILE_ATTRIBUTE_DIRECTORY))
 | 
|---|
| 5 | #endif
 | 
|---|
| 6 | 
 | 
|---|
| 7 | #undef A_W
 | 
|---|
| 8 | #undef I_SHFileStrCpyCatA_W
 | 
|---|
| 9 | 
 | 
|---|
| 10 | #ifdef I_SHFileStrCpyCatA
 | 
|---|
| 11 | #undef I_SHFileStrCpyCatA
 | 
|---|
| 12 | #define I_SHFileStrCpyCatA_W SHFileStrCpyCatA
 | 
|---|
| 13 | #define A_W 1
 | 
|---|
| 14 | #endif
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #ifdef I_SHFileStrCpyCatW
 | 
|---|
| 17 | #undef I_SHFileStrCpyCatW
 | 
|---|
| 18 | #define I_SHFileStrCpyCatA_W SHFileStrCpyCatW
 | 
|---|
| 19 | #define A_W 0
 | 
|---|
| 20 | #endif
 | 
|---|
| 21 | 
 | 
|---|
| 22 | #undef LPSTR_A_W
 | 
|---|
| 23 | #undef LPCSTR_A_W
 | 
|---|
| 24 | #undef lstrcpy_A_W
 | 
|---|
| 25 | #undef strrchr_A_W
 | 
|---|
| 26 | #undef lstrlen_A_W
 | 
|---|
| 27 | 
 | 
|---|
| 28 | #if A_W
 | 
|---|
| 29 | #define LPSTR_A_W LPSTR
 | 
|---|
| 30 | #define LPCSTR_A_W LPCSTR
 | 
|---|
| 31 | #define lstrcpy_A_W lstrcpyA
 | 
|---|
| 32 | #define strrchr_A_W strrchr
 | 
|---|
| 33 | #define lstrlen_A_W lstrlenA
 | 
|---|
| 34 | #else
 | 
|---|
| 35 | #define LPSTR_A_W LPWSTR
 | 
|---|
| 36 | #define LPCSTR_A_W LPCWSTR
 | 
|---|
| 37 | #define lstrcpy_A_W lstrcpyW
 | 
|---|
| 38 | #define strrchr_A_W strrchrW
 | 
|---|
| 39 | #define lstrlen_A_W lstrlenW
 | 
|---|
| 40 | #endif
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #undef A_W
 | 
|---|
| 43 | 
 | 
|---|
| 44 | #ifdef I_SHFileStrCpyCatA_W
 | 
|---|
| 45 | LPSTR_A_W I_SHFileStrCpyCatA_W(LPSTR_A_W pTo, LPCSTR_A_W pFrom, LPCSTR_A_W pCatStr)
 | 
|---|
| 46 | {
 | 
|---|
| 47 | #undef I_SHFileStrCpyCatA_W
 | 
|---|
| 48 |   LPSTR_A_W pToFile = NULL;
 | 
|---|
| 49 |   int  i_len;
 | 
|---|
| 50 |   if (pTo)
 | 
|---|
| 51 |   {
 | 
|---|
| 52 |     if (pFrom)
 | 
|---|
| 53 |       lstrcpy_A_W(pTo, pFrom);
 | 
|---|
| 54 |     if (pCatStr)
 | 
|---|
| 55 |     {
 | 
|---|
| 56 |       i_len = lstrlen_A_W(pTo);
 | 
|---|
| 57 |       if ((i_len) && (pTo[--i_len] != '\\'))
 | 
|---|
| 58 |         i_len++;
 | 
|---|
| 59 |       pTo[i_len] = '\\';
 | 
|---|
| 60 |       if (pCatStr[0] == '\\')
 | 
|---|
| 61 |         pCatStr++; \
 | 
|---|
| 62 |       lstrcpy_A_W(&pTo[i_len+1], pCatStr);
 | 
|---|
| 63 |     }
 | 
|---|
| 64 |     pToFile = strrchr_A_W(pTo,'\\');
 | 
|---|
| 65 | /* !! termination of the new string-group */
 | 
|---|
| 66 |     pTo[(lstrlen_A_W(pTo)) + 1] = '\0';
 | 
|---|
| 67 |   }
 | 
|---|
| 68 |   return pToFile;
 | 
|---|
| 69 | }
 | 
|---|
| 70 | #undef SHFileStrCpyCatA_W
 | 
|---|
| 71 | #endif
 | 
|---|
| 72 | #if 0
 | 
|---|
| 73 | #define SHFileStrCpyCat(A) LPSTR_##A SHFileStrCpyCat##A(LPSTR_##A pTo, LPCSTR_##A pFrom, LPCSTR_##A pCatStr) \
 | 
|---|
| 74 | {  \
 | 
|---|
| 75 |   LPSTR_##A pToFile = NULL;  \
 | 
|---|
| 76 |   int  i_len; \
 | 
|---|
| 77 |   if (pTo)    \
 | 
|---|
| 78 |   {           \
 | 
|---|
| 79 |     if (pFrom)    \
 | 
|---|
| 80 |       lstrcpy##A(pTo, pFrom);   \
 | 
|---|
| 81 |     if (pCatStr) \
 | 
|---|
| 82 |     {  \
 | 
|---|
| 83 |       i_len = lstrlen##A(pTo); \
 | 
|---|
| 84 |       if ((i_len) && (pTo[--i_len] != '\\')) \
 | 
|---|
| 85 |         i_len++;  \
 | 
|---|
| 86 |       pTo[i_len] = '\\'; \
 | 
|---|
| 87 |       if (pCatStr[0] == '\\') \
 | 
|---|
| 88 |         pCatStr++; \
 | 
|---|
| 89 |       lstrcpy##A(&pTo[i_len+1], pCatStr); \
 | 
|---|
| 90 |     }  \
 | 
|---|
| 91 |     pToFile = strrchr##A(pTo,'\\');   \
 | 
|---|
| 92 | /* !! termination of the new string-group */   \
 | 
|---|
| 93 |     pTo[(lstrlen##A(pTo)) + 1] = '\0';   \
 | 
|---|
| 94 |   }  \
 | 
|---|
| 95 |   return pToFile; \
 | 
|---|
| 96 | }
 | 
|---|
| 97 | #endif
 | 
|---|
| 98 | 
 | 
|---|