imagehlp_main.c 2.1 KB
Newer Older
1 2 3 4
/*
 *	IMAGEHLP library
 *
 *	Copyright 1998	Patrik Stridvall
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 20
 */

21 22 23 24
#include <stdarg.h>

#include "windef.h"
#include "winbase.h"
25
#include "imagehlp.h"
26
#include "wine/debug.h"
27 28

/**********************************************************************/
29
DECLSPEC_HIDDEN HANDLE IMAGEHLP_hHeap = NULL;
30 31

/***********************************************************************
32
 *           DllMain (IMAGEHLP.init)
33
 */
34
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
35 36 37 38
{
  switch(fdwReason)
    {
    case DLL_PROCESS_ATTACH:
39
      DisableThreadLibraryCalls(hinstDLL);
40
      IMAGEHLP_hHeap = HeapCreate(0, 0x10000, 0);
41 42
      break;
    case DLL_PROCESS_DETACH:
43
      if (lpvReserved) break;
44
      HeapDestroy(IMAGEHLP_hHeap);
45 46 47 48 49 50
      break;
    }
  return TRUE;
}

/***********************************************************************
51
 *           MarkImageAsRunFromSwap (IMAGEHLP.@)
52 53 54 55 56
 * FIXME
 *   No documentation available.
 */

/***********************************************************************
57
 *           TouchFileTimes (IMAGEHLP.@)
58
 */
59
BOOL WINAPI TouchFileTimes(HANDLE FileHandle, LPSYSTEMTIME lpSystemTime)
60
{
61 62 63 64 65 66 67 68 69 70 71
  FILETIME FileTime;
  SYSTEMTIME SystemTime;

  if(lpSystemTime == NULL)
  {
    GetSystemTime(&SystemTime);
    lpSystemTime = &SystemTime;
  }

  return (SystemTimeToFileTime(lpSystemTime, &FileTime) &&
          SetFileTime(FileHandle, NULL, NULL, &FileTime));
72
}