-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WindwowsString/WindowsFilePath support wrt AFPP
- Loading branch information
Showing
32 changed files
with
2,552 additions
and
974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#if __GLASGOW_HASKELL__ >= 709 | ||
{-# LANGUAGE Safe #-} | ||
#else | ||
{-# LANGUAGE Trustworthy #-} | ||
#endif | ||
----------------------------------------------------------------------------- | ||
-- | | ||
-- Module : System.Win32.DLL.Internal | ||
-- Copyright : (c) Alastair Reid, 1997-2003 | ||
-- License : BSD-style (see the file libraries/base/LICENSE) | ||
-- | ||
-- Maintainer : Esa Ilari Vuokko <[email protected]> | ||
-- Stability : provisional | ||
-- Portability : portable | ||
-- | ||
-- A collection of FFI declarations for interfacing with Win32. | ||
-- | ||
----------------------------------------------------------------------------- | ||
|
||
module System.Win32.DLL.Internal where | ||
|
||
import System.Win32.Types | ||
|
||
##include "windows_cconv.h" | ||
|
||
#include <windows.h> | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h DisableThreadLibraryCalls" | ||
c_DisableThreadLibraryCalls :: HMODULE -> IO Bool | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h FreeLibrary" | ||
c_FreeLibrary :: HMODULE -> IO Bool | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" | ||
c_GetModuleFileName :: HMODULE -> LPTSTR -> Int -> IO Bool | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h GetModuleHandleW" | ||
c_GetModuleHandle :: LPCTSTR -> IO HMODULE | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h GetProcAddress" | ||
c_GetProcAddress :: HMODULE -> LPCSTR -> IO Addr | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h LoadLibraryW" | ||
c_LoadLibrary :: LPCTSTR -> IO HINSTANCE | ||
|
||
type LoadLibraryFlags = DWORD | ||
|
||
#{enum LoadLibraryFlags, | ||
, lOAD_LIBRARY_AS_DATAFILE = LOAD_LIBRARY_AS_DATAFILE | ||
, lOAD_WITH_ALTERED_SEARCH_PATH = LOAD_WITH_ALTERED_SEARCH_PATH | ||
} | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h LoadLibraryExW" | ||
c_LoadLibraryEx :: LPCTSTR -> HANDLE -> LoadLibraryFlags -> IO HINSTANCE | ||
|
||
foreign import WINDOWS_CCONV unsafe "windows.h SetDllDirectoryW" | ||
c_SetDllDirectory :: LPTSTR -> IO BOOL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
----------------------------------------------------------------------------- | ||
-- | | ||
-- Module : System.Win32.WindowsString.DebugApi.Internal | ||
-- Copyright : (c) Esa Ilari Vuokko, 2006 | ||
-- License : BSD-style (see the file LICENSE) | ||
-- | ||
-- Maintainer : Esa Ilari Vuokko <[email protected]> | ||
-- Stability : provisional | ||
-- Portability : portable | ||
-- | ||
-- A collection of FFI declarations for using Windows DebugApi. | ||
-- | ||
----------------------------------------------------------------------------- | ||
|
||
module System.Win32.DebugApi.Internal where | ||
|
||
import Data.Word ( Word8, Word32 ) | ||
import Foreign ( Ptr ) | ||
import System.Win32.Types ( BOOL, DWORD, HANDLE, LPTSTR ) | ||
|
||
##include "windows_cconv.h" | ||
#include "windows.h" | ||
|
||
type PID = DWORD | ||
type TID = DWORD | ||
type DebugEventId = (PID, TID) | ||
type ForeignAddress = Word32 | ||
|
||
type PHANDLE = Ptr () | ||
type THANDLE = Ptr () | ||
|
||
type ThreadInfo = (THANDLE, ForeignAddress, ForeignAddress) -- handle to thread, thread local, thread start | ||
type ImageInfo = (HANDLE, ForeignAddress, DWORD, DWORD, ForeignAddress) | ||
type ExceptionInfo = (Bool, Bool, ForeignAddress) -- First chance, continuable, address | ||
|
||
-------------------------------------------------------------------------- | ||
-- Raw imports | ||
|
||
foreign import WINDOWS_CCONV "windows.h SuspendThread" | ||
c_SuspendThread :: THANDLE -> IO DWORD | ||
|
||
foreign import WINDOWS_CCONV "windows.h ResumeThread" | ||
c_ResumeThread :: THANDLE -> IO DWORD | ||
|
||
foreign import WINDOWS_CCONV "windows.h WaitForDebugEvent" | ||
c_WaitForDebugEvent :: Ptr () -> DWORD -> IO BOOL | ||
|
||
foreign import WINDOWS_CCONV "windows.h ContinueDebugEvent" | ||
c_ContinueDebugEvent :: DWORD -> DWORD -> DWORD -> IO BOOL | ||
|
||
foreign import WINDOWS_CCONV "windows.h DebugActiveProcess" | ||
c_DebugActiveProcess :: DWORD -> IO Bool | ||
|
||
-- Windows XP | ||
-- foreign import WINDOWS_CCONV "windows.h DebugActiveProcessStop" | ||
-- c_DebugActiveProcessStop :: DWORD -> IO Bool | ||
|
||
foreign import WINDOWS_CCONV "windows.h ReadProcessMemory" c_ReadProcessMemory :: | ||
PHANDLE -> Ptr () -> Ptr Word8 -> DWORD -> Ptr DWORD -> IO BOOL | ||
|
||
foreign import WINDOWS_CCONV "windows.h WriteProcessMemory" c_WriteProcessMemory :: | ||
PHANDLE -> Ptr () -> Ptr Word8 -> DWORD -> Ptr DWORD -> IO BOOL | ||
|
||
foreign import WINDOWS_CCONV "windows.h GetThreadContext" | ||
c_GetThreadContext :: THANDLE -> Ptr () -> IO BOOL | ||
|
||
foreign import WINDOWS_CCONV "windows.h SetThreadContext" | ||
c_SetThreadContext :: THANDLE -> Ptr () -> IO BOOL | ||
|
||
--foreign import WINDOWS_CCONV "windows.h GetThreadId" | ||
-- c_GetThreadId :: THANDLE -> IO TID | ||
|
||
foreign import WINDOWS_CCONV "windows.h OutputDebugStringW" | ||
c_OutputDebugString :: LPTSTR -> IO () | ||
|
||
foreign import WINDOWS_CCONV "windows.h IsDebuggerPresent" | ||
isDebuggerPresent :: IO BOOL | ||
|
||
foreign import WINDOWS_CCONV "windows.h DebugBreak" | ||
debugBreak :: IO () |
Oops, something went wrong.