From 7620e6adb81607c939802c81bf8c068faf0211f8 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 17 Jun 2017 06:19:46 +0300 Subject: use windows_cconv.h from Win32 --- src/WindowsEnv/Environment.hs | 4 ++-- src/WindowsEnv/Registry.hs | 8 ++++---- src/WindowsEnv/Utils.hs | 4 ++-- src/WindowsEnv/ccall.h | 13 ------------- 4 files changed, 8 insertions(+), 21 deletions(-) delete mode 100644 src/WindowsEnv/ccall.h (limited to 'src/WindowsEnv') diff --git a/src/WindowsEnv/Environment.hs b/src/WindowsEnv/Environment.hs index 6784d43..5ad6315 100644 --- a/src/WindowsEnv/Environment.hs +++ b/src/WindowsEnv/Environment.hs @@ -100,11 +100,11 @@ pathSplit = filter (not . null) . splitOn pathSep pathJoin :: [String] -> String pathJoin = intercalate pathSep . filter (not . null) -#include "ccall.h" +#include "windows_cconv.h" -- ExpandEnvironmentStrings isn't provided by Win32 (as of version 2.4.0.0). -foreign import WINDOWS_ENV_CCALL unsafe "Windows.h ExpandEnvironmentStringsW" +foreign import WINDOWS_CCONV unsafe "Windows.h ExpandEnvironmentStringsW" c_ExpandEnvironmentStrings :: WinAPI.LPCTSTR -> WinAPI.LPTSTR -> WinAPI.DWORD -> IO WinAPI.ErrCode expand :: String -> ExceptT IOError IO String diff --git a/src/WindowsEnv/Registry.hs b/src/WindowsEnv/Registry.hs index 3121d9d..ba7cfc6 100644 --- a/src/WindowsEnv/Registry.hs +++ b/src/WindowsEnv/Registry.hs @@ -145,17 +145,17 @@ decodeString (valueType, valueData) = (valueType, T.unpack dropLastZero) | otherwise = T.takeWhile (/= '\0') text text = decodeUtf16LE valueData -#include "ccall.h" +#include "windows_cconv.h" -- These aren't provided by Win32 (as of version 2.4.0.0). -foreign import WINDOWS_ENV_CCALL unsafe "Windows.h RegQueryValueExW" +foreign import WINDOWS_CCONV unsafe "Windows.h RegQueryValueExW" c_RegQueryValueEx :: WinAPI.PKEY -> WinAPI.LPCTSTR -> WinAPI.LPDWORD -> WinAPI.LPDWORD -> WinAPI.LPBYTE -> WinAPI.LPDWORD -> IO WinAPI.ErrCode -foreign import WINDOWS_ENV_CCALL unsafe "Windows.h RegSetValueExW" +foreign import WINDOWS_CCONV unsafe "Windows.h RegSetValueExW" c_RegSetValueEx :: WinAPI.PKEY -> WinAPI.LPCTSTR -> WinAPI.DWORD -> WinAPI.DWORD -> WinAPI.LPBYTE -> WinAPI.DWORD -> IO WinAPI.ErrCode -foreign import WINDOWS_ENV_CCALL unsafe "Windows.h RegGetValueW" +foreign import WINDOWS_CCONV unsafe "Windows.h RegGetValueW" c_RegGetValue :: WinAPI.PKEY -> WinAPI.LPCTSTR -> WinAPI.LPCTSTR -> WinAPI.DWORD -> WinAPI.LPDWORD -> WinAPI.LPBYTE -> WinAPI.LPDWORD -> IO WinAPI.ErrCode queryValue :: IsKeyPath a => a -> ValueName -> ExceptT IOError IO Value diff --git a/src/WindowsEnv/Utils.hs b/src/WindowsEnv/Utils.hs index 2dffaef..6371328 100644 --- a/src/WindowsEnv/Utils.hs +++ b/src/WindowsEnv/Utils.hs @@ -16,11 +16,11 @@ import qualified Graphics.Win32.GDI.Types as WinAPI import qualified Graphics.Win32.Message as WinAPI import qualified System.Win32.Types as WinAPI -#include "ccall.h" +#include "windows_cconv.h" -- SendNotifyMessage isn't provided by Win32 (as of version 2.4.0.0). -foreign import WINDOWS_ENV_CCALL "Windows.h SendNotifyMessageW" +foreign import WINDOWS_CCONV "Windows.h SendNotifyMessageW" c_SendNotifyMessage :: WinAPI.HWND -> WinAPI.WindowMessage -> WinAPI.WPARAM -> WinAPI.LPARAM -> IO WinAPI.LRESULT notifyEnvironmentUpdate :: IO () diff --git a/src/WindowsEnv/ccall.h b/src/WindowsEnv/ccall.h deleted file mode 100644 index 541cd5e..0000000 --- a/src/WindowsEnv/ccall.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef WINDOWS_ENV_CCALL_H -#define WINDOWS_ENV_CCALL_H - -#if defined(i386_HOST_ARCH) -#define WINDOWS_ENV_CCALL stdcall -#elif defined(x86_64_HOST_ARCH) -#define WINDOWS_ENV_CCALL ccall -#else -#define WINDOWS_ENV_CCALL ccall -#warning "Unsupported architecture" -#endif - -#endif -- cgit v1.2.3