| 1 | // |
| 2 | // Copyright (c) Microsoft. All rights reserved. |
| 3 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 4 | // |
| 5 | |
| 6 | //---------------------------------------------------------- |
| 7 | // verbMerge.h - verb that merges multiple .MC into one .MCH file |
| 8 | // It allows .MC names to be Unicode names with long paths. |
| 9 | //---------------------------------------------------------- |
| 10 | #ifndef _verbMerge |
| 11 | #define _verbMerge |
| 12 | |
| 13 | class verbMerge |
| 14 | { |
| 15 | public: |
| 16 | static int DoWork(const char* nameOfOutputFile, const char* pattern, bool recursive); |
| 17 | |
| 18 | private: |
| 19 | typedef bool (*DirectoryFilterFunction_t)(WIN32_FIND_DATAW*); |
| 20 | static bool DirectoryFilterDirectories(WIN32_FIND_DATAW* findData); |
| 21 | static bool DirectoryFilterFile(WIN32_FIND_DATAW* findData); |
| 22 | static int __cdecl WIN32_FIND_DATAW_qsort_helper(const void* p1, const void* p2); |
| 23 | static int FilterDirectory(LPCWSTR searchPattern, |
| 24 | DirectoryFilterFunction_t filter, |
| 25 | /* out */ WIN32_FIND_DATAW** ppFileArray, |
| 26 | int* pElemCount); |
| 27 | |
| 28 | static LPWSTR MergePathStrings(LPCWSTR dir, LPCWSTR file); |
| 29 | |
| 30 | static char* ConvertWideCharToMultiByte(LPCWSTR wstr); |
| 31 | |
| 32 | static int AppendFile(HANDLE hFileOut, LPCWSTR fileName, unsigned char* buffer, size_t bufferSize); |
| 33 | static int AppendAllInDir(HANDLE hFileOut, |
| 34 | LPCWSTR dir, |
| 35 | LPCWSTR file, |
| 36 | unsigned char* buffer, |
| 37 | size_t bufferSize, |
| 38 | bool recursive, |
| 39 | /* out */ LONGLONG* size); |
| 40 | }; |
| 41 | #endif |
| 42 | |