]> wimlib.net Git - wimlib/blobdiff - tests/wlfuzz.c
Update hyperlinks
[wimlib] / tests / wlfuzz.c
index 35cefbe5c3846d9fcaae2c4d5a8fb762f983dff0..eccedbaa02ac47116431b99db342813e59f81673 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2015-2016 Eric Biggers
+ * Copyright (C) 2015-2021 Eric Biggers
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 /*
@@ -66,7 +66,7 @@
 #endif
 #include <unistd.h>
 
-#ifdef __WIN32__
+#ifdef _WIN32
 #  include <windows.h>
 #  include <winternl.h>
 #  include <ntstatus.h>
@@ -119,7 +119,7 @@ assertion_failed(int line, const char *format, ...)
 static void
 change_to_temporary_directory(void)
 {
-#ifdef __WIN32__
+#ifdef _WIN32
        ASSERT(SetCurrentDirectory(L"E:\\"),
               "failed to change directory to E:\\");
 #else
@@ -186,19 +186,19 @@ create_ntfs_volume(const char *name)
 }
 #endif /* WITH_NTFS_3G */
 
-#ifdef __WIN32__
+#ifdef _WIN32
 
-extern WINAPI NTSTATUS NtQueryDirectoryFile (HANDLE FileHandle,
-                                            HANDLE Event,
-                                            PIO_APC_ROUTINE ApcRoutine,
-                                            PVOID ApcContext,
-                                            PIO_STATUS_BLOCK IoStatusBlock,
-                                            PVOID FileInformation,
-                                            ULONG Length,
-                                            FILE_INFORMATION_CLASS FileInformationClass,
-                                            BOOLEAN ReturnSingleEntry,
-                                            PUNICODE_STRING FileName,
-                                            BOOLEAN RestartScan);
+WINAPI NTSTATUS NtQueryDirectoryFile(HANDLE FileHandle,
+                                    HANDLE Event,
+                                    PIO_APC_ROUTINE ApcRoutine,
+                                    PVOID ApcContext,
+                                    PIO_STATUS_BLOCK IoStatusBlock,
+                                    PVOID FileInformation,
+                                    ULONG Length,
+                                    FILE_INFORMATION_CLASS FileInformationClass,
+                                    BOOLEAN ReturnSingleEntry,
+                                    PUNICODE_STRING FileName,
+                                    BOOLEAN RestartScan);
 
 static void
 delete_directory_tree_recursive(HANDLE cur_dir, UNICODE_STRING *name)
@@ -300,7 +300,7 @@ delete_directory_tree(const wchar_t *name)
        ASSERT(GetFileAttributes(name) == 0xFFFFFFFF, "Deletion didn't work!");
 }
 
-#else /* __WIN32__ */
+#else /* _WIN32 */
 
 static void
 delete_directory_tree_recursive(int dirfd, const char *name)
@@ -332,7 +332,7 @@ delete_directory_tree(const tchar *name)
        delete_directory_tree_recursive(AT_FDCWD, name);
 }
 
-#endif /* !__WIN32__ */
+#endif /* !_WIN32 */
 
 static uint32_t
 rand32(void)
@@ -411,7 +411,7 @@ get_image_count(WIMStruct *wim)
        return info.image_count;
 }
 
-#ifdef __WIN32__
+#ifdef _WIN32
 static bool
 is_wimboot_capable(WIMStruct *wim)
 {
@@ -426,7 +426,7 @@ is_wimboot_capable(WIMStruct *wim)
                 (info.compression_type == WIMLIB_COMPRESSION_TYPE_LZX &&
                  info.chunk_size == 32768));
 }
-#endif /* __WIN32__ */
+#endif /* _WIN32 */
 
 static void
 overwrite_wim(WIMStruct *wim)
@@ -778,15 +778,15 @@ op__apply_and_capture_test(void)
        } else
 #endif
        {
-#ifdef __WIN32__
+#ifdef _WIN32
                printf("applying in Windows mode\n");
                cmp_flags |= WIMLIB_CMP_FLAG_WINDOWS_MODE;
-#else /* __WIN32__ */
+#else /* _WIN32 */
                printf("applying in UNIX mode\n");
                extract_flags |= WIMLIB_EXTRACT_FLAG_UNIX_DATA;
                add_flags |= WIMLIB_ADD_FLAG_UNIX_DATA;
                cmp_flags |= WIMLIB_CMP_FLAG_UNIX_MODE;
-#endif /* !__WIN32__ */
+#endif /* !_WIN32 */
        }
        add_flags |= WIMLIB_ADD_FLAG_NORPFIX;
        CHECK_RET(wimlib_extract_image(wim, image, TMP_TARGET_NAME,
@@ -810,7 +810,7 @@ op__apply_and_capture_test(void)
        wimlib_free(wim);
 }
 
-#ifdef __WIN32__
+#ifdef _WIN32
 
 /* Enumerate and unregister all backing WIMs from the specified volume  */
 static void
@@ -820,10 +820,10 @@ unregister_all_backing_wims(const tchar drive_letter)
        HANDLE h;
        void *overlay_list;
        DWORD bytes_returned;
-       const struct wim_provider_overlay_entry *entry;
+       const WIM_PROVIDER_OVERLAY_ENTRY *entry;
        struct {
-               struct wof_external_info wof_info;
-               struct wim_provider_remove_overlay_input wim;
+               WOF_EXTERNAL_INFO wof_info;
+               WIM_PROVIDER_REMOVE_OVERLAY_INPUT wim;
        } in;
 
        wsprintf(volume, L"\\\\.\\%lc:", drive_letter);
@@ -837,11 +837,11 @@ unregister_all_backing_wims(const tchar drive_letter)
        overlay_list = malloc(32768);
        ASSERT(overlay_list != NULL, "out of memory");
 
-       in.wof_info.version = WOF_CURRENT_VERSION;
-       in.wof_info.provider = WOF_PROVIDER_WIM;
+       in.wof_info.Version = WOF_CURRENT_VERSION;
+       in.wof_info.Provider = WOF_PROVIDER_WIM;
 
        if (!DeviceIoControl(h, FSCTL_ENUM_OVERLAY,
-                            &in, sizeof(struct wof_external_info),
+                            &in, sizeof(WOF_EXTERNAL_INFO),
                             overlay_list, 32768, &bytes_returned, NULL))
        {
                ASSERT(GetLastError() == ERROR_INVALID_FUNCTION ||
@@ -854,16 +854,16 @@ unregister_all_backing_wims(const tchar drive_letter)
        entry = overlay_list;
        for (;;) {
                printf("Unregistering data source ID %"PRIu64"\n",
-                      entry->data_source_id);
-               in.wim.data_source_id = entry->data_source_id;
+                      entry->DataSourceId.QuadPart);
+               in.wim.DataSourceId = entry->DataSourceId;
                ASSERT(DeviceIoControl(h, FSCTL_REMOVE_OVERLAY, &in, sizeof(in),
                                       NULL, 0, &bytes_returned, NULL),
                       "FSCTL_REMOVE_OVERLAY failed; error=%u",
                       (unsigned )GetLastError());
-               if (entry->next_entry_offset == 0)
+               if (entry->NextEntryOffset == 0)
                        break;
-               entry = (const struct wim_provider_overlay_entry *)
-                       ((const uint8_t *)entry + entry->next_entry_offset);
+               entry = (const WIM_PROVIDER_OVERLAY_ENTRY *)
+                       ((const uint8_t *)entry + entry->NextEntryOffset);
        }
        free(overlay_list);
        CloseHandle(h);
@@ -931,7 +931,7 @@ op__wimboot_test(void)
        wimlib_free(wim);
        wimlib_free(wim2);
 }
-#endif /* __WIN32__ */
+#endif /* _WIN32 */
 
 static int
 is_solid_resource(const struct wimlib_resource_entry *resource, void *_ctx)
@@ -1039,13 +1039,13 @@ static const operation_func operation_table[] = {
        op__apply_and_capture_test,
        op__split_test,
        op__set_compression_level,
-#ifdef __WIN32__
+#ifdef _WIN32
        op__wimboot_test,
 #endif
 };
 
-#ifdef __WIN32__
-extern int wmain(int argc, wchar_t **argv);
+#ifdef _WIN32
+int wmain(int argc, wchar_t **argv);
 #define main wmain
 #endif