X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwim.c;h=1ffc3fef442dccb5e0760bcd28db5f3cbbd99a31;hb=8c26ca707e56d9848e52076ad3f7c26ea7fa338d;hp=af4580285e54593e719397eae1f4a29afd1bdcf8;hpb=7533ac106a7e642b0a49d7733be4eeaf9763bd03;p=wimlib diff --git a/src/wim.c b/src/wim.c index af458028..1ffc3fef 100644 --- a/src/wim.c +++ b/src/wim.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2012 Eric Biggers + * Copyright (C) 2012, 2013 Eric Biggers * * wimlib - Library for working with WIM files * @@ -24,6 +24,14 @@ */ #include "config.h" + +#ifdef __WIN32__ +# include +# ifdef ERROR +# undef ERROR +# endif +#endif + #include #include #include @@ -43,6 +51,32 @@ #include "lookup_table.h" #include "xml.h" +#ifdef __WIN32__ +static char *realpath(const char *path, char *resolved_path) +{ + DWORD ret; + wimlib_assert(resolved_path == NULL); + + ret = GetFullPathNameA(path, 0, NULL, NULL); + if (!ret) + goto fail_win32; + + resolved_path = MALLOC(ret + 1); + if (!resolved_path) + goto fail; + ret = GetFullPathNameA(path, ret, resolved_path, NULL); + if (!ret) { + free(resolved_path); + goto fail_win32; + } + return resolved_path; +fail_win32: + win32_error(GetLastError()); +fail: + return NULL; +} +#endif + static int image_print_metadata(WIMStruct *w) { DEBUG("Printing metadata for image %d", w->current_image); @@ -599,7 +633,7 @@ void destroy_image_metadata(struct wim_image_metadata *imd, * closes all files associated with the WIMStruct. */ WIMLIBAPI void wimlib_free(WIMStruct *w) { - DEBUG2("Freeing WIMStruct"); + DEBUG("Freeing WIMStruct"); if (!w) return; @@ -635,6 +669,7 @@ WIMLIBAPI void wimlib_free(WIMStruct *w) } #endif FREE(w); + DEBUG("Freed WIMStruct"); } /* Get global memory allocations out of the way. Not strictly necessary in