win32, ...: avoid including windows.h

Include the most specific header documented by MSDN instead.
This commit is contained in:
Max Kellermann 2021-05-19 17:24:02 +02:00
parent a6cb3139db
commit a169a05e41
17 changed files with 38 additions and 17 deletions

View File

@ -24,7 +24,7 @@
#ifdef _WIN32
#include <windows.h>
#include <fileapi.h>
#include <tchar.h>
/**

View File

@ -42,7 +42,10 @@
#include <cstdint>
#ifdef _WIN32
#include <windows.h>
#include <fileapi.h>
#include <windef.h> // for HWND (needed by winbase.h)
#include <handleapi.h> // for INVALID_HANDLE_VALUE
#include <winbase.h> // for FILE_END
#endif
#if defined(__linux__) && !defined(ANDROID)

View File

@ -35,7 +35,10 @@
#include "util/Compiler.h"
#ifdef _WIN32
#include <windows.h>
#include <fileapi.h>
#include <handleapi.h> // for INVALID_HANDLE_VALUE
#include <windef.h> // for HWND (needed by winbase.h)
#include <winbase.h> // for FILE_CURRENT
#else
#include "io/UniqueFileDescriptor.hxx"
#endif

View File

@ -28,6 +28,10 @@
#include <array>
#include <iterator>
#include <handleapi.h>
#include <synchapi.h>
#include <winbase.h> // for INFINITE
#include <stdlib.h>
#include <string.h>

View File

@ -26,7 +26,7 @@
#include "util/Compiler.h"
#include <windows.h>
#include <windef.h>
#include <mmsystem.h>
struct WinmmOutput;

View File

@ -49,7 +49,9 @@ FormatSystemError(std::error_code code, const char *fmt,
#ifdef _WIN32
#include <windows.h>
#include <errhandlingapi.h> // for GetLastError()
#include <windef.h> // for HWND (needed by winbase.h)
#include <winbase.h> // for FormatMessageA()
static inline std::system_error
MakeLastError(DWORD code, const char *msg) noexcept

View File

@ -27,7 +27,9 @@
#include <cstring>
#ifdef _WIN32
#include <windows.h>
#include <errhandlingapi.h> // for GetLastError()
#include <windef.h> // for HWND (needed by winbase.h)
#include <winbase.h> // for FormatMessageA()
#else
#include <cerrno>
#endif

View File

@ -30,7 +30,7 @@
#ifndef THREAD_CRITICAL_SECTION_HXX
#define THREAD_CRITICAL_SECTION_HXX
#include <windows.h>
#include <synchapi.h>
/**
* Wrapper for a CRITICAL_SECTION, backend for the Mutex class.

View File

@ -23,7 +23,7 @@
#include "util/Compiler.h"
#ifdef _WIN32
#include <windows.h>
#include <processthreadsapi.h>
#else
#include <pthread.h>
#endif

View File

@ -26,7 +26,7 @@
#include <cassert>
#ifdef _WIN32
#include <windows.h>
#include <processthreadsapi.h>
#else
#include <pthread.h>
#endif

View File

@ -32,6 +32,9 @@
#include "CriticalSection.hxx"
#include <windef.h> // for HWND (needed by winbase.h)
#include <winbase.h> // for INFINITE
#include <chrono>
#include <mutex>

View File

@ -77,7 +77,7 @@ void
HugeDiscard(void *p, size_t size) noexcept;
#elif defined(_WIN32)
#include <windows.h>
#include <memoryapi.h>
WritableBuffer<void>
HugeAllocate(size_t size);

View File

@ -21,8 +21,8 @@
#define MPD_WIN32_COM_HXX
#include "HResult.hxx"
#include <objbase.h>
#include <windows.h>
#include <combaseapi.h>
// RAII for Microsoft Component Object Model(COM)
// https://docs.microsoft.com/en-us/windows/win32/api/_com/

View File

@ -23,7 +23,8 @@
#include <cstddef>
#include <objbase.h>
#include <utility>
#include <windows.h>
#include <combaseapi.h>
// RAII for CoTaskMemAlloc and CoTaskMemFree
// https://docs.microsoft.com/zh-tw/windows/win32/api/combaseapi/nf-combaseapi-cotaskmemalloc

View File

@ -21,10 +21,12 @@
#define MPD_WIN32_COMPTR_HXX
#include "win32/HResult.hxx"
#include <cstddef>
#include <objbase.h>
#include <utility>
#include <windows.h>
#include <combaseapi.h>
// RAII for Object in Microsoft Component Object Model(COM)
// https://docs.microsoft.com/zh-tw/windows/win32/api/_com/

View File

@ -26,8 +26,6 @@
#include <boost/lockfree/spsc_queue.hpp>
#include <windows.h>
// Worker thread for all COM operation
class COMWorker {
Thread thread{BIND_THIS_METHOD(Work)};

View File

@ -20,7 +20,10 @@
#ifndef MPD_WIN32_WINEVENT_HXX
#define MPD_WIN32_WINEVENT_HXX
#include <windows.h>
#include <handleapi.h>
#include <synchapi.h>
#include <windef.h> // for HWND (needed by winbase.h)
#include <winbase.h> // for INFINITE
// RAII for Windows unnamed event object
// https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw