diff options
Diffstat (limited to 'Plugins/utils/mir_memory.h')
-rw-r--r-- | Plugins/utils/mir_memory.h | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/Plugins/utils/mir_memory.h b/Plugins/utils/mir_memory.h index 52440ae..b3f32fc 100644 --- a/Plugins/utils/mir_memory.h +++ b/Plugins/utils/mir_memory.h @@ -21,19 +21,52 @@ Boston, MA 02111-1307, USA. #ifndef __MIR_MEMORY_H__
# define __MIR_MEMORY_H__
+
#include <windows.h>
-// Need to be called on ME_SYSTEM_MODULESLOADED or Load
-void init_mir_malloc();
+static BOOL mir_is_unicode()
+{
+ char ver[1024];
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver);
+ return strstr(ver, "Unicode") != NULL;
+}
+
+
+static void * mir_alloc0(size_t size)
+{
+ void * ptr = mir_alloc(size);
+
+ if (ptr != NULL)
+ memset(ptr, 0, size);
+
+ return ptr;
+}
+
+static int strcmpnull(char *str1, char *str2)
+{
+ if ( str1 == NULL && str2 == NULL )
+ return 0;
+ if ( str1 != NULL && str2 == NULL )
+ return 1;
+ if ( str1 == NULL && str2 != NULL )
+ return -1;
-BOOL mir_is_unicode();
+ return strcmp(str1, str2);
+}
+static int strcmpnullW(WCHAR *str1, WCHAR *str2)
+{
+ if ( str1 == NULL && str2 == NULL )
+ return 0;
+ if ( str1 != NULL && str2 == NULL )
+ return 1;
+ if ( str1 == NULL && str2 != NULL )
+ return -1;
-void * mir_alloc0(size_t size);
-int strcmpnull(char *str1, char *str2);
-int strcmpnullW(WCHAR *str1, WCHAR *str2);
+ return lstrcmpW(str1, str2);
+}
#ifdef UNICODE
|