Fixed a race condition on RPC worker thread creation, and a typo.
[wine] / dlls / imagehlp / imagehlp_main.c
1 /*
2  *      IMAGEHLP library
3  *
4  *      Copyright 1998  Patrik Stridvall
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "imagehlp.h"
22 #include "winerror.h"
23 #include "winbase.h"
24 #include "windef.h"
25 #include "wine/debug.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(imagehlp);
28
29 /**********************************************************************/
30
31 HANDLE IMAGEHLP_hHeap = NULL;
32
33 static API_VERSION IMAGEHLP_ApiVersion = { 4, 0, 0, 5 };
34
35 /***********************************************************************
36  *           DllMain (IMAGEHLP.init)
37  */
38 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
39 {
40   switch(fdwReason)
41     {
42     case DLL_PROCESS_ATTACH:
43       IMAGEHLP_hHeap = HeapCreate(0, 0x10000, 0);
44       break;
45     case DLL_PROCESS_DETACH:
46       HeapDestroy(IMAGEHLP_hHeap);
47       IMAGEHLP_hHeap = NULL;
48       break;
49     case DLL_THREAD_ATTACH:
50       break;
51     case DLL_THREAD_DETACH:
52       break;
53     default:
54       break;
55     }
56   return TRUE;
57 }
58
59 /***********************************************************************
60  *           ImagehlpApiVersion (IMAGEHLP.@)
61  */
62 PAPI_VERSION WINAPI ImagehlpApiVersion()
63 {
64   return &IMAGEHLP_ApiVersion;
65 }
66
67 /***********************************************************************
68  *           ImagehlpApiVersionEx (IMAGEHLP.@)
69  */
70 PAPI_VERSION WINAPI ImagehlpApiVersionEx(PAPI_VERSION AppVersion)
71 {
72   if(!AppVersion)
73     return NULL;
74
75   AppVersion->MajorVersion = IMAGEHLP_ApiVersion.MajorVersion;
76   AppVersion->MinorVersion = IMAGEHLP_ApiVersion.MinorVersion;
77   AppVersion->Revision = IMAGEHLP_ApiVersion.Revision;
78   AppVersion->Reserved = IMAGEHLP_ApiVersion.Reserved;
79
80   return AppVersion;
81 }
82
83 /***********************************************************************
84  *           MakeSureDirectoryPathExists (IMAGEHLP.@)
85  */
86 BOOL WINAPI MakeSureDirectoryPathExists(LPCSTR DirPath)
87 {
88     if (CreateDirectoryA(DirPath,NULL))
89         return TRUE;
90     if (GetLastError() == ERROR_ALREADY_EXISTS)
91     {
92         SetLastError(ERROR_SUCCESS);
93         return TRUE;
94     }
95     return FALSE;
96 }
97
98 /***********************************************************************
99  *           MarkImageAsRunFromSwap (IMAGEHLP.@)
100  * FIXME
101  *   No documentation available.
102  */
103
104 /***********************************************************************
105  *           SearchTreeForFile (IMAGEHLP.@)
106  */
107 BOOL WINAPI SearchTreeForFile(
108   LPSTR RootPath, LPSTR InputPathName, LPSTR OutputPathBuffer)
109 {
110   FIXME("(%s, %s, %s): stub\n",
111     debugstr_a(RootPath), debugstr_a(InputPathName),
112     debugstr_a(OutputPathBuffer)
113   );
114   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
115   return FALSE;
116 }
117
118 /***********************************************************************
119  *           TouchFileTimes (IMAGEHLP.@)
120  */
121 BOOL WINAPI TouchFileTimes(
122   HANDLE FileHandle, LPSYSTEMTIME lpSystemTime)
123 {
124   FIXME("(%p, %p): stub\n",
125     FileHandle, lpSystemTime
126   );
127   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
128   return FALSE;
129 }