OLD | NEW |
| (Empty) |
1 // Copyright 2004-2009 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #ifndef OMAHA_COMMON_MODULE_UTILS_H_ | |
17 #define OMAHA_COMMON_MODULE_UTILS_H_ | |
18 | |
19 #include "omaha/base/string.h" | |
20 | |
21 namespace omaha { | |
22 | |
23 // Utilities for working with modules in processes. | |
24 | |
25 // Returns the module handle of a module, given a pointer to a static | |
26 // member of the module (e.g. a static function or static variable). | |
27 HMODULE ModuleFromStatic(void* pointer_to_static_in_module); | |
28 | |
29 // Copies the path of the directory that contains the file for 'module' into | |
30 // 'directory'. | |
31 // | |
32 // @param module Must be a valid, non-NULL module handle. | |
33 // @param directory MUST have room for MAX_PATH characters or more. The path | |
34 // copied into this buffer will not have a trailing backslash. | |
35 // | |
36 // @return false iff there is an error. | |
37 bool GetModuleDirectory(HMODULE module, TCHAR* directory); | |
38 | |
39 /** | |
40 * Returns a path to a module. Uses the | |
41 * Win32 GetModuleFileName function, so you | |
42 * can pass NULL for module. | |
43 * | |
44 * @param module Handle to the module or NULL for the current module. | |
45 * @param path Holds the path to the module on successful return. | |
46 * @returns S_OK if successful, otherwise an error value. | |
47 */ | |
48 HRESULT GetModuleFileName(HMODULE module, OUT CString* path); | |
49 | |
50 } // namespace omaha | |
51 | |
52 #endif // OMAHA_COMMON_MODULE_UTILS_H_ | |
OLD | NEW |