123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "windows.h"
- #include "stdint.h"
- void *malloc(size_t sz)
- {
- return HeapAlloc(GetProcessHeap(), 0, sz);
- }
- void free(void *addr)
- {
- HeapFree(GetProcessHeap(), 0, addr);
- }
- void *realloc(void *addr, size_t sz)
- {
- return HeapReAlloc(GetProcessHeap(), 0, addr, sz);
- }
- void *memset(void *p, int c, size_t n)
- {
- int i;
- for (i = 0; i < n; i++) {
- ((uint8_t *)p)[i] = c;
- }
- return p;
- }
- int strcmp(const char *a, const char *b)
- {
- int i;
- for (i = 0; *a == *b && *a && *b ; i++) {
- a++;
- b++;
- }
- if (*a < *b)
- return -1;
- else if (*a > *b)
- return 1;
- else
- return 0;
- }
- int strlen(const char *a)
- {
- int i = 0;
- while (*a) {
- i++;
- a++;
- }
- return i;
- }
- void exit(int code)
- {
- ExitProcess(code == 0 ? 0 : 1);
- }
|