diff --git a/Runtimes/Overlay/Windows/clang/CMakeLists.txt b/Runtimes/Overlay/Windows/clang/CMakeLists.txt index 1994da8bc38bb..7f75c8bf0b4a6 100644 --- a/Runtimes/Overlay/Windows/clang/CMakeLists.txt +++ b/Runtimes/Overlay/Windows/clang/CMakeLists.txt @@ -19,6 +19,9 @@ roots: - name: module.modulemap type: file external-contents: "@CMAKE_CURRENT_SOURCE_DIR@/winsdk_um.modulemap" + - name: WinSDK.apinotes + type: file + external-contents: "@CMAKE_CURRENT_SOURCE_DIR@/WinSDK.apinotes" - name: "@WindowsSdkDir@/Include/@WindowsSDKVersion@/shared" type: directory contents: @@ -51,6 +54,7 @@ install(TARGETS ClangModules EXPORT SwiftOverlayTargets) install(FILES ucrt.modulemap + WinSDK.apinotes vcruntime.apinotes vcruntime.modulemap winsdk_um.modulemap diff --git a/Runtimes/Resync.cmake b/Runtimes/Resync.cmake index 4268a0fdb354f..1b50199463c73 100644 --- a/Runtimes/Resync.cmake +++ b/Runtimes/Resync.cmake @@ -199,6 +199,7 @@ message(STATUS "Windows modulemaps[${StdlibSources}/Platform] -> ${CMAKE_CURRENT copy_files(public/Platform Overlay/Windows/clang FILES ucrt.modulemap + WinSDK.apinotes winsdk_um.modulemap winsdk_shared.modulemap vcruntime.modulemap diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index ed51df1996da5..10c7559035e93 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -3709,7 +3709,7 @@ void ClangImporter::lookupBridgingHeaderDecls( if (filter(macroNode)) { auto MI = macroNode.getAsMacro(); Identifier Name = Impl.getNameImporter().importMacroName(II, MI); - if (Decl *imported = Impl.importMacro(Name, macroNode)) + if (Decl *imported = Impl.importMacro(Name, macroNode, II)) receiver(imported); } } @@ -3787,7 +3787,7 @@ bool ClangImporter::lookupDeclsFromHeader(StringRef Filename, ClangNode MacroNode = Info; if (filter(MacroNode)) { auto Name = Impl.getNameImporter().importMacroName(II, Info); - if (auto *Imported = Impl.importMacro(Name, MacroNode)) + if (auto *Imported = Impl.importMacro(Name, MacroNode, II)) receiver(Imported); } }); diff --git a/lib/ClangImporter/ClangIncludePaths.cpp b/lib/ClangImporter/ClangIncludePaths.cpp index 40c3b6a5a5053..ddca439717eaf 100644 --- a/lib/ClangImporter/ClangIncludePaths.cpp +++ b/lib/ClangImporter/ClangIncludePaths.cpp @@ -549,6 +549,14 @@ void GetWindowsFileMappings( fileMapping.redirectedFiles.emplace_back(std::string(WinSDKInjection), AuxiliaryFile); + llvm::sys::path::remove_filename(WinSDKInjection); + llvm::sys::path::append(WinSDKInjection, "WinSDK.apinotes"); + AuxiliaryFile = GetPlatformAuxiliaryFile("windows", "WinSDK.apinotes", + VFS, SearchPathOpts); + if (!AuxiliaryFile.empty()) + fileMapping.redirectedFiles.emplace_back(std::string(WinSDKInjection), + AuxiliaryFile); + llvm::sys::path::remove_filename(WinSDKInjection); llvm::sys::path::remove_filename(WinSDKInjection); llvm::sys::path::append(WinSDKInjection, "shared", "module.modulemap"); diff --git a/lib/ClangImporter/ImportMacro.cpp b/lib/ClangImporter/ImportMacro.cpp index 1f98e5fcf7ae1..0e59033111cca 100644 --- a/lib/ClangImporter/ImportMacro.cpp +++ b/lib/ClangImporter/ImportMacro.cpp @@ -18,6 +18,7 @@ #include "ImporterImpl.h" #include "SwiftDeclSynthesizer.h" #include "swift/AST/ASTContext.h" +#include "swift/AST/Attr.h" #include "swift/AST/DiagnosticsClangImporter.h" #include "swift/AST/Expr.h" #include "swift/AST/ParameterList.h" @@ -40,6 +41,40 @@ using namespace swift; using namespace importer; +static Type importMacroTypeOverride(ClangImporter::Implementation &Impl, + DeclContext *DC, + const clang::IdentifierInfo *II, + const clang::MacroInfo *macro, + ClangNode ClangN) { + if (!II) + return Type(); + + clang::Sema &S = Impl.getClangSema(); + auto Info = S.ProcessAPINotes(ClangN.getOwningClangModule(), II, + macro->getDefinitionLoc()); + if (!Info || Info->getType().empty()) + return Type(); + + if (!S.ParseTypeFromStringCallback) + return Type(); + + // Resolve the APINotes 'Type:' annotation. Parsing the C type string is left + // to Clang's parser (via ParseTypeFromStringCallback); we only trigger it. + auto Ty = S.ParseTypeFromStringCallback(Info->getType(), "", + macro->getDefinitionLoc()); + if (!Ty.isUsable()) + return Type(); + + clang::QualType QualTy = clang::Sema::GetTypeFromParser(Ty.get()); + if (QualTy.isNull()) + return Type(); + + return Impl.importTypeIgnoreIUO( + QualTy, ImportTypeKind::Value, + ImportDiagnosticAdder(Impl, macro, macro->getDefinitionLoc()), + isInSystemModule(DC), Bridgeability::None, ImportTypeAttrs()); +} + template static const T * parseNumericLiteral(ClangImporter::Implementation &impl, @@ -61,9 +96,22 @@ getTokenSpelling(ClangImporter::Implementation &impl, const clang::Token &tok) { return tokenSpelling; } +static bool applyCUnsignedIntegerCastExpr(llvm::APSInt &Value, + clang::QualType Ty, + const clang::ASTContext &C) { + if (Ty.isNull() || !Ty->isIntegerType() || Ty->isBooleanType() || + !Ty->isUnsignedIntegerOrEnumerationType()) + return false; + + Value = Value.extOrTrunc(C.getIntWidth(Ty)); + Value.setIsUnsigned(true); + return true; +} + static ValueDecl * createMacroConstant(ClangImporter::Implementation &Impl, const clang::MacroInfo *macro, + const clang::IdentifierInfo *II, Identifier name, DeclContext *dc, Type type, @@ -71,6 +119,9 @@ createMacroConstant(ClangImporter::Implementation &Impl, ConstantConvertKind convertKind, bool isStatic, ClangNode ClangN) { + if (Type T = importMacroTypeOverride(Impl, dc, II, macro, ClangN)) + type = T; + Impl.ImportedMacroConstants[macro] = {value, type}; return SwiftDeclSynthesizer(Impl).createConstant(name, dc, type, value, convertKind, isStatic, @@ -80,6 +131,7 @@ createMacroConstant(ClangImporter::Implementation &Impl, static ValueDecl *importNumericLiteral(ClangImporter::Implementation &Impl, DeclContext *DC, const clang::MacroInfo *MI, + const clang::IdentifierInfo *II, Identifier name, const clang::Token *signTok, const clang::Token &tok, @@ -139,6 +191,8 @@ static ValueDecl *importNumericLiteral(ClangImporter::Implementation &Impl, value.flipAllBits(); } } + applyCUnsignedIntegerCastExpr(value, castType, + Impl.getClangASTContext()); // Make sure the destination type actually conforms to the builtin literal // protocol or is Bool before attempting to import, otherwise we'll crash @@ -151,7 +205,7 @@ static ValueDecl *importNumericLiteral(ClangImporter::Implementation &Impl, !ctx.getIntBuiltinInitDecl(constantTyNominal)) { return nullptr; } - return createMacroConstant(Impl, MI, name, DC, constantType, + return createMacroConstant(Impl, MI, II, name, DC, constantType, clang::APValue(value), ConstantConvertKind::None, /*static*/ false, ClangN); @@ -179,7 +233,7 @@ static ValueDecl *importNumericLiteral(ClangImporter::Implementation &Impl, if (!ctx.getFloatBuiltinInitDecl(constantTyNominal)) return nullptr; - return createMacroConstant(Impl, MI, name, DC, constantType, + return createMacroConstant(Impl, MI, II, name, DC, constantType, clang::APValue(value), ConstantConvertKind::None, /*static*/ false, ClangN); @@ -235,6 +289,7 @@ static ValueDecl *importStringLiteral(ClangImporter::Implementation &Impl, static ValueDecl *importLiteral(ClangImporter::Implementation &Impl, DeclContext *DC, const clang::MacroInfo *MI, + const clang::IdentifierInfo *II, Identifier name, const clang::Token &tok, ClangNode ClangN, @@ -242,7 +297,8 @@ static ValueDecl *importLiteral(ClangImporter::Implementation &Impl, switch (tok.getKind()) { case clang::tok::numeric_constant: { ValueDecl *importedNumericLiteral = importNumericLiteral( - Impl, DC, MI, name, /*signTok*/ nullptr, tok, ClangN, castType); + Impl, DC, MI, II, name, /*signTok*/ nullptr, tok, ClangN, + castType); if (!importedNumericLiteral) { Impl.addImportDiagnostic( &tok, Diagnostic(diag::macro_not_imported_invalid_numeric_literal), @@ -382,7 +438,7 @@ getIntegerConstantForMacroToken(ClangImporter::Implementation &impl, macroNode = moduleMacro; } auto importedID = impl.getNameImporter().importMacroName(rawID, macroInfo); - (void)impl.importMacro(importedID, macroNode); + (void)impl.importMacro(importedID, macroNode, rawID); auto searcher = impl.ImportedMacroConstants.find(macroInfo); if (searcher == impl.ImportedMacroConstants.end()) { @@ -502,6 +558,7 @@ ValueDecl *importDeclAlias(ClangImporter::Implementation &clang, static ValueDecl *importMacro(ClangImporter::Implementation &impl, llvm::SmallSet &visitedMacros, DeclContext *DC, Identifier name, + const clang::IdentifierInfo *II, const clang::MacroInfo *macro, ClangNode ClangN, clang::QualType castType) { if (name.empty()) return nullptr; @@ -598,7 +655,8 @@ static ValueDecl *importMacro(ClangImporter::Implementation &impl, // If it's a literal token, we might be able to translate the literal. if (tok.isLiteral()) { - return importLiteral(impl, DC, macro, name, tok, ClangN, castType); + return importLiteral(impl, DC, macro, II, name, tok, ClangN, + castType); } if (tok.is(clang::tok::identifier)) { @@ -632,8 +690,8 @@ static ValueDecl *importMacro(ClangImporter::Implementation &impl, // FIXME: This was clearly intended to pass the cast type down, but // doing so would be a behavior change. - return importMacro(impl, visitedMacros, DC, name, macroID, ClangN, - /*castType*/ {}); + return importMacro(impl, visitedMacros, DC, name, II, macroID, + ClangN, /*castType*/ {}); } } @@ -662,7 +720,7 @@ static ValueDecl *importMacro(ClangImporter::Implementation &impl, if (isSignToken(first) && second.is(clang::tok::numeric_constant)) { ValueDecl *importedNumericLiteral = importNumericLiteral( - impl, DC, macro, name, &first, second, ClangN, castType); + impl, DC, macro, II, name, &first, second, ClangN, castType); if (!importedNumericLiteral) { impl.addImportDiagnostic( macro, Diagnostic(diag::macro_not_imported, name.str()), @@ -861,7 +919,18 @@ static ValueDecl *importMacro(ClangImporter::Implementation &impl, return nullptr; } - return createMacroConstant(impl, macro, name, DC, resultSwiftType, + if (applyCUnsignedIntegerCastExpr(resultValue, castType, + impl.getClangASTContext())) { + resultSwiftType = impl.importTypeIgnoreIUO( + castType, ImportTypeKind::Value, + ImportDiagnosticAdder(impl, macro, macro->getDefinitionLoc()), + isInSystemModule(DC), Bridgeability::None, ImportTypeAttrs()); + if (!resultSwiftType) + return nullptr; + } + + return createMacroConstant(impl, macro, II, name, DC, + resultSwiftType, clang::APValue(resultValue), ConstantConvertKind::None, /*isStatic=*/false, ClangN); @@ -905,12 +974,20 @@ static ValueDecl *importMacro(ClangImporter::Implementation &impl, return nullptr; } -ValueDecl *ClangImporter::Implementation::importMacro(Identifier name, - ClangNode macroNode) { +ValueDecl *ClangImporter::Implementation::importMacro( + Identifier name, ClangNode macroNode, + const clang::IdentifierInfo *II) { const clang::MacroInfo *macro = macroNode.getAsMacro(); if (!macro) return nullptr; + if (!II) { + if (const auto *M = macroNode.getAsModuleMacro()) + II = M->getName(); + else + II = getClangPreprocessor().getIdentifierInfo(name.str()); + } + PrettyStackTraceStringAction stackRAII{"importing macro", name.str()}; // Look for macros imported with the same name. @@ -949,11 +1026,12 @@ ValueDecl *ClangImporter::Implementation::importMacro(Identifier name, // result. DeclContext *DC; - if (const clang::Module *module = - importer::getClangOwningModule(macroNode, getClangASTContext())) { + const clang::Module *Module = + importer::getClangOwningModule(macroNode, getClangASTContext()); + if (Module) { // Get the parent module because currently we don't model Clang submodules // in Swift. - DC = getWrapperForModule(module->getTopLevelModule()); + DC = getWrapperForModule(Module->getTopLevelModule()); } else { DC = ImportedHeaderUnit; } @@ -961,7 +1039,7 @@ ValueDecl *ClangImporter::Implementation::importMacro(Identifier name, llvm::SmallSet visitedMacros; visitedMacros.insert(name.str()); auto valueDecl = - ::importMacro(*this, visitedMacros, DC, name, macro, macroNode, + ::importMacro(*this, visitedMacros, DC, name, II, macro, macroNode, /*castType*/ {}); // Update the entry for the value we just imported. @@ -976,6 +1054,20 @@ ValueDecl *ClangImporter::Implementation::importMacro(Identifier name, assert(entryIter != llvm::reverse(ImportedMacros[name]).end() && "placeholder not found"); entryIter->second = valueDecl; + + // If APINotes renamed this macro and we imported it under its original C + // name, mark this declaration as unavailable and redirect to the Swift + // name, mirroring how renamed Clang declarations are imported. The Swift + // name is whatever importMacroName resolves for the original identifier; if + // it differs from the name we imported under, this is the renamed-from C + // name. + Identifier imported = getNameImporter().importMacroName(II, macro, Module); + if (!imported.empty() && imported != name) { + ASTContext &AST = valueDecl->getASTContext(); + valueDecl->addAttribute(AvailableAttr::createUnavailableInSwift( + AST, /*Message=*/StringRef(), + /*Rename=*/AST.AllocateCopy(imported.str()))); + } } return valueDecl; diff --git a/lib/ClangImporter/ImportName.cpp b/lib/ClangImporter/ImportName.cpp index 78a30f4490d18..a4e367cc84a29 100644 --- a/lib/ClangImporter/ImportName.cpp +++ b/lib/ClangImporter/ImportName.cpp @@ -2618,16 +2618,26 @@ Identifier ImportedName::getBaseIdentifier(ASTContext &ctx) const { } Identifier -NameImporter::importMacroName(const clang::IdentifierInfo *clangIdentifier, - const clang::MacroInfo *macro) { +NameImporter::importMacroName(const clang::IdentifierInfo *II, + const clang::MacroInfo *MI, + const clang::Module *M) { // If we're supposed to ignore this macro, return an empty identifier. - if (::shouldIgnoreMacro(clangIdentifier->getName(), macro, - getClangPreprocessor())) + if (::shouldIgnoreMacro(II->getName(), MI, getClangPreprocessor())) return Identifier(); - // No transformation is applied to the name. - StringRef name = clangIdentifier->getName(); - return swiftCtx.getIdentifier(name); + // Honor an APINotes 'SwiftName:' override, if one applies. A macro constant + // can only be renamed to a simple identifier, so reject function, operator, + // and member names, which are meaningless here. + if (auto notes = getClangSema().ProcessAPINotes(M, II, MI->getDefinitionLoc())) { + if (!notes->SwiftName.empty()) { + ParsedDeclName ident = parseDeclName(notes->SwiftName); + if (ident && !ident.isOperator() && !ident.IsFunctionName && !ident.isMember()) + return swiftCtx.getIdentifier(ident.BaseName); + } + } + + // Otherwise, no transformation is applied to the name. + return swiftCtx.getIdentifier(II->getName()); } ImportedName NameImporter::importName(const clang::NamedDecl *decl, diff --git a/lib/ClangImporter/ImportName.h b/lib/ClangImporter/ImportName.h index ce5de9abc8646..4da15f5771a6f 100644 --- a/lib/ClangImporter/ImportName.h +++ b/lib/ClangImporter/ImportName.h @@ -461,8 +461,13 @@ class NameImporter { llvm::function_ref action); /// Imports the name of the given Clang macro into Swift. - Identifier importMacroName(const clang::IdentifierInfo *clangIdentifier, - const clang::MacroInfo *macro); + /// + /// If APINotes provides a 'SwiftName:' for the macro, that name is used; + /// \p M allows module APINotes sidecars to be consulted in addition to + /// location-based notes. + Identifier importMacroName(const clang::IdentifierInfo *II, + const clang::MacroInfo *MI, + const clang::Module *M = nullptr); ASTContext &getContext() { return swiftCtx; } const LangOptions &getLangOpts() const { return swiftCtx.LangOpts; } diff --git a/lib/ClangImporter/ImporterImpl.h b/lib/ClangImporter/ImporterImpl.h index b7e712d4583ab..19d671a6109d0 100644 --- a/lib/ClangImporter/ImporterImpl.h +++ b/lib/ClangImporter/ImporterImpl.h @@ -1168,7 +1168,8 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation /// /// \returns The imported declaration, or null if the macro could not be /// translated into Swift. - ValueDecl *importMacro(Identifier name, ClangNode macroNode); + ValueDecl *importMacro(Identifier name, ClangNode macroNode, + const clang::IdentifierInfo *II = nullptr); /// Map a Clang identifier name to its imported Swift equivalent. StringRef getSwiftNameFromClangName(StringRef name); diff --git a/lib/ClangImporter/SwiftLookupTable.cpp b/lib/ClangImporter/SwiftLookupTable.cpp index 3303688ff541c..9aecab72f42a1 100644 --- a/lib/ClangImporter/SwiftLookupTable.cpp +++ b/lib/ClangImporter/SwiftLookupTable.cpp @@ -2083,13 +2083,27 @@ void importer::addMacrosToLookupTable(SwiftLookupTable &table, } // Add this entry. - auto name = nameImporter.importMacroName(macro.first, info); + const clang::Module *Module = + moduleMacro ? moduleMacro->getOwningModule() : nullptr; + auto name = nameImporter.importMacroName(macro.first, info, Module); if (name.empty()) return; - if (moduleMacro) - table.addEntry(name, moduleMacro, tu); - else - table.addEntry(name, info, tu); + + auto addEntry = [&](Identifier entryName) { + if (moduleMacro) + table.addEntry(entryName, moduleMacro, tu); + else + table.addEntry(entryName, info, tu); + }; + + addEntry(name); + + // If APINotes renamed this macro, also register it under its original C + // name so that a reference to the old name still resolves (to an + // unavailable redirect synthesized in importMacro). + auto rawName = nameImporter.getIdentifier(macro.first->getName()); + if (!rawName.empty() && rawName != name) + addEntry(rawName); }; ArrayRef moduleMacros = diff --git a/stdlib/cmake/WindowsVFS.yaml.in b/stdlib/cmake/WindowsVFS.yaml.in index 9a728125ebd74..a3c3713715965 100644 --- a/stdlib/cmake/WindowsVFS.yaml.in +++ b/stdlib/cmake/WindowsVFS.yaml.in @@ -9,6 +9,9 @@ roots: - name: module.modulemap type: file external-contents: "@PROJECT_SOURCE_DIR@\\public\\Platform\\winsdk_um.modulemap" + - name: WinSDK.apinotes + type: file + external-contents: "@PROJECT_SOURCE_DIR@\\public\\Platform\\WinSDK.apinotes" - name: "@UniversalCRTSdkDir@\\Include\\@UCRTVersion@\\shared" type: directory contents: @@ -30,4 +33,3 @@ roots: - name: vcruntime.apinotes type: file external-contents: "@PROJECT_SOURCE_DIR@\\public\\Platform\\vcruntime.apinotes" - diff --git a/stdlib/public/Platform/CMakeLists.txt b/stdlib/public/Platform/CMakeLists.txt index c126e5c8d7593..1ef993eb52277 100644 --- a/stdlib/public/Platform/CMakeLists.txt +++ b/stdlib/public/Platform/CMakeLists.txt @@ -570,6 +570,7 @@ add_dependencies(sdk-overlay emscriptenlibc_modulemap) if(WINDOWS IN_LIST SWIFT_SDKS) swift_install_in_component(FILES ucrt.modulemap + WinSDK.apinotes vcruntime.apinotes vcruntime.modulemap winsdk_um.modulemap diff --git a/stdlib/public/Platform/WinSDK.apinotes b/stdlib/public/Platform/WinSDK.apinotes new file mode 100644 index 0000000000000..6e99da5534262 --- /dev/null +++ b/stdlib/public/Platform/WinSDK.apinotes @@ -0,0 +1,791 @@ +--- +Name: WinSDK +Globals: +- Name: ABOVE_NORMAL_PRIORITY_CLASS + Type: DWORD +- Name: BACKGROUND_BLUE + Type: WORD +- Name: BELOW_NORMAL_PRIORITY_CLASS + Type: DWORD +- Name: C3_FULLWIDTH + Type: WORD +- Name: CONSOLE_TEXTMODE_BUFFER + Type: DWORD +- Name: COPY_FILE_COPY_SYMLINK + Type: DWORD +- Name: COPY_FILE_DIRECTORY + Type: DWORD +- Name: COPY_FILE_FAIL_IF_EXISTS + Type: DWORD +- Name: COPY_FILE_NO_BUFFERING + Type: DWORD +- Name: COPY_FILE_OPEN_AND_COPY_REPARSE_POINT + Type: DWORD +- Name: CREATE_ALWAYS + Type: DWORD +- Name: CREATE_BREAKAWAY_FROM_JOB + Type: DWORD +- Name: CREATE_DEFAULT_ERROR_MODE + Type: DWORD +- Name: CREATE_NEW + Type: DWORD +- Name: CREATE_NEW_CONSOLE + Type: DWORD +- Name: CREATE_NEW_PROCESS_GROUP + Type: DWORD +- Name: CREATE_NO_WINDOW + Type: DWORD +- Name: CREATE_PRESERVE_CODE_AUTHZ_LEVEL + Type: DWORD +- Name: CREATE_PROCESS_DEBUG_EVENT + Type: DWORD +- Name: CREATE_PROTECTED_PROCESS + Type: DWORD +- Name: CREATE_SECURE_PROCESS + Type: DWORD +- Name: CREATE_SEPARATE_WOW_VDM + Type: DWORD +- Name: CREATE_SHARED_WOW_VDM + Type: DWORD +- Name: CREATE_SUSPENDED + Type: DWORD +- Name: CREATE_THREAD_DEBUG_EVENT + Type: DWORD +- Name: CREATE_UNICODE_ENVIRONMENT + Type: DWORD +- Name: CS_DBLCLKS + Type: UINT +- Name: CTRL_BREAK_EVENT + Type: DWORD +- Name: CTRL_CLOSE_EVENT + Type: DWORD +- Name: CTRL_C_EVENT + Type: DWORD +- Name: CTRL_LOGOFF_EVENT + Type: DWORD +- Name: CTRL_SHUTDOWN_EVENT + Type: DWORD +- Name: CT_CTYPE3 + Type: DWORD +- Name: DEBUG_ONLY_THIS_PROCESS + Type: DWORD +- Name: DEBUG_PROCESS + Type: DWORD +- Name: DELETE + Type: DWORD +- Name: DETACHED_PROCESS + Type: DWORD +- Name: DEVICE_NOTIFY_WINDOW_HANDLE + Type: DWORD +- Name: DISABLE_NEWLINE_AUTO_RETURN + Type: DWORD +- Name: DOMAIN_ALIAS_RID_ADMINS + Type: DWORD +- Name: DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE + Type: DPI_AWARENESS_CONTEXT +- Name: DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 + Type: DPI_AWARENESS_CONTEXT +- Name: DPI_AWARENESS_CONTEXT_SYSTEM_AWARE + Type: DPI_AWARENESS_CONTEXT +- Name: DPI_AWARENESS_CONTEXT_UNAWARE + Type: DPI_AWARENESS_CONTEXT +- Name: DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED + Type: DPI_AWARENESS_CONTEXT +- Name: DUPLICATE_SAME_ACCESS + Type: DWORD +- Name: ENABLE_LINE_INPUT + Type: DWORD +- Name: ENABLE_PROCESSED_INPUT + Type: DWORD +- Name: ENABLE_PROCESSED_OUTPUT + Type: DWORD +- Name: ENABLE_VIRTUAL_TERMINAL_PROCESSING + Type: DWORD +- Name: ENABLE_WRAP_AT_EOL_OUTPUT + Type: DWORD +- Name: ERROR_ACCESS_DENIED + Type: DWORD +- Name: ERROR_ALREADY_EXISTS + Type: DWORD +- Name: ERROR_ARENA_TRASHED + Type: DWORD +- Name: ERROR_ARITHMETIC_OVERFLOW + Type: DWORD +- Name: ERROR_BAD_ARGUMENTS + Type: DWORD +- Name: ERROR_BAD_ENVIRONMENT + Type: DWORD +- Name: ERROR_BAD_EXE_FORMAT + Type: DWORD +- Name: ERROR_BAD_FORMAT + Type: DWORD +- Name: ERROR_BAD_NETPATH + Type: DWORD +- Name: ERROR_BAD_NET_NAME + Type: DWORD +- Name: ERROR_BAD_PATHNAME + Type: DWORD +- Name: ERROR_BROKEN_PIPE + Type: DWORD +- Name: ERROR_CANNOT_MAKE + Type: DWORD +- Name: ERROR_CHILD_NOT_COMPLETE + Type: DWORD +- Name: ERROR_CURRENT_DIRECTORY + Type: DWORD +- Name: ERROR_DIRECTORY + Type: DWORD +- Name: ERROR_DIRECT_ACCESS_HANDLE + Type: DWORD +- Name: ERROR_DIR_NOT_EMPTY + Type: DWORD +- Name: ERROR_DISK_FULL + Type: DWORD +- Name: ERROR_DISK_RESOURCES_EXHAUSTED + Type: DWORD +- Name: ERROR_DRIVE_LOCKED + Type: DWORD +- Name: ERROR_ENVVAR_NOT_FOUND + Type: DWORD +- Name: ERROR_EXE_MARKED_INVALID + Type: DWORD +- Name: ERROR_FAIL_I24 + Type: DWORD +- Name: ERROR_FILENAME_EXCED_RANGE + Type: DWORD +- Name: ERROR_FILE_EXISTS + Type: DWORD +- Name: ERROR_FILE_NOT_FOUND + Type: DWORD +- Name: ERROR_ILLEGAL_CHARACTER + Type: DWORD +- Name: ERROR_INFLOOP_IN_RELOC_CHAIN + Type: DWORD +- Name: ERROR_INSUFFICIENT_BUFFER + Type: DWORD +- Name: ERROR_INVALID_ACCESS + Type: DWORD +- Name: ERROR_INVALID_BLOCK + Type: DWORD +- Name: ERROR_INVALID_DATA + Type: DWORD +- Name: ERROR_INVALID_DRIVE + Type: DWORD +- Name: ERROR_INVALID_EXE_SIGNATURE + Type: DWORD +- Name: ERROR_INVALID_FUNCTION + Type: DWORD +- Name: ERROR_INVALID_HANDLE + Type: DWORD +- Name: ERROR_INVALID_NAME + Type: DWORD +- Name: ERROR_INVALID_PARAMETER + Type: DWORD +- Name: ERROR_INVALID_STARTING_CODESEG + Type: DWORD +- Name: ERROR_INVALID_TARGET_HANDLE + Type: DWORD +- Name: ERROR_IO_PENDING + Type: DWORD +- Name: ERROR_LABEL_TOO_LONG + Type: DWORD +- Name: ERROR_LOCKED + Type: DWORD +- Name: ERROR_LOCK_FAILED + Type: DWORD +- Name: ERROR_LOCK_VIOLATION + Type: DWORD +- Name: ERROR_MAX_THRDS_REACHED + Type: DWORD +- Name: ERROR_NEGATIVE_SEEK + Type: DWORD +- Name: ERROR_NESTING_NOT_ALLOWED + Type: DWORD +- Name: ERROR_NETWORK_ACCESS_DENIED + Type: DWORD +- Name: ERROR_NOT_ENOUGH_MEMORY + Type: DWORD +- Name: ERROR_NOT_ENOUGH_QUOTA + Type: DWORD +- Name: ERROR_NOT_FOUND + Type: DWORD +- Name: ERROR_NOT_LOCKED + Type: DWORD +- Name: ERROR_NOT_SAME_DEVICE + Type: DWORD +- Name: ERROR_NO_MORE_FILES + Type: DWORD +- Name: ERROR_NO_PROC_SLOTS + Type: DWORD +- Name: ERROR_NO_UNICODE_TRANSLATION + Type: DWORD +- Name: ERROR_OPERATION_ABORTED + Type: DWORD +- Name: ERROR_OUTOFMEMORY + Type: DWORD +- Name: ERROR_PATH_NOT_FOUND + Type: DWORD +- Name: ERROR_PIPE_BUSY + Type: DWORD +- Name: ERROR_PIPE_CONNECTED + Type: DWORD +- Name: ERROR_SEEK_ON_DEVICE + Type: DWORD +- Name: ERROR_SHARING_BUFFER_EXCEEDED + Type: DWORD +- Name: ERROR_SHARING_VIOLATION + Type: DWORD +- Name: ERROR_SUCCESS + Type: DWORD +- Name: ERROR_TOO_MANY_OPEN_FILES + Type: DWORD +- Name: ERROR_WAIT_NO_CHILDREN + Type: DWORD +- Name: ERROR_WRITE_FAULT + Type: DWORD +- Name: ERROR_WRITE_PROTECT + Type: DWORD +- Name: EVENT_ALL_ACCESS + Type: DWORD +- Name: EVENT_MODIFY_STATE + Type: DWORD +- Name: EVENT_SYSTEM_FOREGROUND + Type: DWORD +- Name: EXCEPTION_DEBUG_EVENT + Type: DWORD +- Name: EXIT_PROCESS_DEBUG_EVENT + Type: DWORD +- Name: EXIT_THREAD_DEBUG_EVENT + Type: DWORD +- Name: EXTENDED_STARTUPINFO_PRESENT + Type: DWORD +- Name: FACILITY_WIN32 + Type: DWORD +- Name: FILE_APPEND_DATA + Type: DWORD +- Name: FILE_ATTRIBUTE_DEVICE + Type: DWORD +- Name: FILE_ATTRIBUTE_DIRECTORY + Type: DWORD +- Name: FILE_ATTRIBUTE_HIDDEN + Type: DWORD +- Name: FILE_ATTRIBUTE_NORMAL + Type: DWORD +- Name: FILE_ATTRIBUTE_READONLY + Type: DWORD +- Name: FILE_ATTRIBUTE_REPARSE_POINT + Type: DWORD +- Name: FILE_ATTRIBUTE_TEMPORARY + Type: DWORD +- Name: FILE_BEGIN + Type: DWORD +- Name: FILE_CURRENT + Type: DWORD +- Name: FILE_DELETE_CHILD + Type: DWORD +- Name: FILE_END + Type: DWORD +- Name: FILE_EXECUTE + Type: DWORD +- Name: FILE_FLAG_BACKUP_SEMANTICS + Type: DWORD +- Name: FILE_FLAG_DELETE_ON_CLOSE + Type: DWORD +- Name: FILE_FLAG_FIRST_PIPE_INSTANCE + Type: DWORD +- Name: FILE_FLAG_OPEN_REPARSE_POINT + Type: DWORD +- Name: FILE_FLAG_OVERLAPPED + Type: DWORD +- Name: FILE_FLAG_RANDOM_ACCESS + Type: DWORD +- Name: FILE_FLAG_SEQUENTIAL_SCAN + Type: DWORD +- Name: FILE_LIST_DIRECTORY + Type: DWORD +- Name: FILE_MAP_ALL_ACCESS + Type: DWORD +- Name: FILE_MAP_READ + Type: DWORD +- Name: FILE_NAME_NORMALIZED + Type: DWORD +- Name: FILE_NOTIFY_CHANGE_CREATION + Type: DWORD +- Name: FILE_NOTIFY_CHANGE_DIR_NAME + Type: DWORD +- Name: FILE_NOTIFY_CHANGE_FILE_NAME + Type: DWORD +- Name: FILE_NOTIFY_CHANGE_LAST_WRITE + Type: DWORD +- Name: FILE_NOTIFY_CHANGE_SIZE + Type: DWORD +- Name: FILE_READ_ATTRIBUTES + Type: DWORD +- Name: FILE_READ_DATA + Type: DWORD +- Name: FILE_READ_EA + Type: DWORD +- Name: FILE_RENAME_FLAG_POSIX_SEMANTICS + Type: DWORD +- Name: FILE_RENAME_FLAG_REPLACE_IF_EXISTS + Type: DWORD +- Name: FILE_SHARE_DELETE + Type: DWORD +- Name: FILE_SHARE_READ + Type: DWORD +- Name: FILE_SHARE_WRITE + Type: DWORD +- Name: FILE_TYPE_CHAR + Type: DWORD +- Name: FILE_TYPE_DISK + Type: DWORD +- Name: FILE_TYPE_PIPE + Type: DWORD +- Name: FILE_TYPE_UNKNOWN + Type: DWORD +- Name: FILE_WRITE_ATTRIBUTES + Type: DWORD +- Name: FILE_WRITE_DATA + Type: DWORD +- Name: FILE_WRITE_EA + Type: DWORD +- Name: FIND_FIRST_EX_LARGE_FETCH + Type: DWORD +- Name: FIND_FIRST_EX_ON_DISK_ENTRIES_ONLY + Type: DWORD +- Name: FIONBIO + Type: int +- Name: FOF_ALLOWUNDO + Type: FILEOP_FLAGS +- Name: FOF_NO_UI + Type: FILEOP_FLAGS +- Name: FOREGROUND_INTENSITY + Type: WORD +- Name: FORMAT_MESSAGE_ALLOCATE_BUFFER + Type: DWORD +- Name: FORMAT_MESSAGE_FROM_HMODULE + Type: DWORD +- Name: FORMAT_MESSAGE_FROM_SYSTEM + Type: DWORD +- Name: FORMAT_MESSAGE_IGNORE_INSERTS + Type: DWORD +- Name: FORMAT_MESSAGE_MAX_WIDTH_MASK + Type: DWORD +- Name: FO_DELETE + Type: UINT +- Name: FROM_LEFT_1ST_BUTTON_PRESSED + Type: DWORD +- Name: FROM_LEFT_2ND_BUTTON_PRESSED + Type: DWORD +- Name: FSCTL_DELETE_REPARSE_POINT + Type: DWORD +- Name: FSCTL_GET_REPARSE_POINT + Type: DWORD +- Name: FSCTL_SET_REPARSE_POINT + Type: DWORD +- Name: GENERIC_READ + Type: DWORD +- Name: GENERIC_WRITE + Type: DWORD +- Name: GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS + Type: DWORD +- Name: GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT + Type: DWORD +- Name: HANDLE_FLAG_INHERIT + Type: DWORD +- Name: HIGH_PRIORITY_CLASS + Type: DWORD +- Name: HKEY_CLASSES_ROOT + Type: HKEY +- Name: HKEY_CURRENT_CONFIG + Type: HKEY +- Name: HKEY_CURRENT_USER + Type: HKEY +- Name: HKEY_CURRENT_USER_LOCAL_SETTINGS + Type: HKEY +- Name: HKEY_DYN_DATA + Type: HKEY +- Name: HKEY_LOCAL_MACHINE + Type: HKEY +- Name: HKEY_PERFORMANCE_DATA + Type: HKEY +- Name: HKEY_PERFORMANCE_NLSTEXT + Type: HKEY +- Name: HKEY_PERFORMANCE_TEXT + Type: HKEY +- Name: HKEY_USERS + Type: HKEY +- Name: IDLE_PRIORITY_CLASS + Type: DWORD +- Name: IMAGE_BITMAP + Type: UINT +- Name: INFINITE + Type: DWORD +- Name: INHERIT_PARENT_AFFINITY + Type: DWORD +- Name: INPUT_KEYBOARD + Type: DWORD +- Name: INVALID_FILE_ATTRIBUTES + Type: DWORD +- Name: INVALID_HANDLE_VALUE + Type: HANDLE +- Name: INVALID_SOCKET + Type: SOCKET +- Name: JOB_OBJECT_LIMIT_ACTIVE_PROCESS + Type: DWORD +- Name: JOB_OBJECT_LIMIT_AFFINITY + Type: DWORD +- Name: JOB_OBJECT_LIMIT_BREAKAWAY_OK + Type: DWORD +- Name: JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION + Type: DWORD +- Name: JOB_OBJECT_LIMIT_JOB_MEMORY + Type: DWORD +- Name: JOB_OBJECT_LIMIT_JOB_TIME + Type: DWORD +- Name: JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE + Type: DWORD +- Name: JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME + Type: DWORD +- Name: JOB_OBJECT_LIMIT_PRIORITY_CLASS + Type: DWORD +- Name: JOB_OBJECT_LIMIT_PROCESS_MEMORY + Type: DWORD +- Name: JOB_OBJECT_LIMIT_PROCESS_TIME + Type: DWORD +- Name: JOB_OBJECT_LIMIT_SCHEDULING_CLASS + Type: DWORD +- Name: JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK + Type: DWORD +- Name: JOB_OBJECT_LIMIT_SUBSET_AFFINITY + Type: DWORD +- Name: JOB_OBJECT_LIMIT_WORKINGSET + Type: DWORD +- Name: KEYEVENTF_KEYUP + Type: DWORD +- Name: KEY_CREATE_SUB_KEY + Type: DWORD +- Name: KEY_ENUMERATE_SUB_KEYS + Type: DWORD +- Name: KEY_EVENT + Type: WORD +- Name: KEY_NOTIFY + Type: DWORD +- Name: KEY_QUERY_VALUE + Type: DWORD +- Name: KEY_READ + Type: DWORD +- Name: KEY_SET_VALUE + Type: DWORD +- Name: LANG_NEUTRAL + Type: WORD +- Name: LEFT_ALT_PRESSED + Type: DWORD +- Name: LEFT_CTRL_PRESSED + Type: DWORD +- Name: LOAD_DLL_DEBUG_EVENT + Type: DWORD +- Name: LOCKFILE_EXCLUSIVE_LOCK + Type: DWORD +- Name: LOGON_WITH_PROFILE + Type: DWORD +- Name: LWA_ALPHA + Type: DWORD +- Name: MAX_PATH + Type: DWORD +- Name: MAX_SYM_NAME + Type: ULONG +- Name: MB_ICONERROR + Type: UINT +- Name: MB_OK + Type: UINT +- Name: MEM_COMMIT + Type: DWORD +- Name: MEM_RELEASE + Type: DWORD +- Name: MONITOR_DEFAULTTONEAREST + Type: DWORD +- Name: MOUSE_EVENT + Type: WORD +- Name: MOUSE_HWHEELED + Type: DWORD +- Name: MOUSE_MOVED + Type: DWORD +- Name: MOUSE_WHEELED + Type: DWORD +- Name: MOVEFILE_COPY_ALLOWED + Type: DWORD +- Name: MOVEFILE_REPLACE_EXISTING + Type: DWORD +- Name: MOVEFILE_WRITE_THROUGH + Type: DWORD +- Name: MUTANT_ALL_ACCESS + Type: DWORD +- Name: MUTANT_QUERY_STATE + Type: DWORD +- Name: MUTEX_ALL_ACCESS + Type: DWORD +- Name: MUTEX_MODIFY_STATE + Type: DWORD +- Name: NI_MAXHOST + Type: DWORD +- Name: NORMAL_PRIORITY_CLASS + Type: DWORD +- Name: NO_INHERITANCE + Type: DWORD +- Name: OPEN_ALWAYS + Type: DWORD +- Name: OPEN_EXISTING + Type: DWORD +- Name: OUTPUT_DEBUG_STRING_EVENT + Type: DWORD +- Name: PAGE_READONLY + Type: DWORD +- Name: PAGE_READWRITE + Type: DWORD +- Name: PIPE_ACCESS_DUPLEX + Type: DWORD +- Name: PIPE_ACCESS_INBOUND + Type: DWORD +- Name: PIPE_ACCESS_OUTBOUND + Type: DWORD +- Name: PIPE_READMODE_BYTE + Type: DWORD +- Name: PIPE_REJECT_REMOTE_CLIENTS + Type: DWORD +- Name: PIPE_TYPE_BYTE + Type: DWORD +- Name: PIPE_WAIT + Type: DWORD +- Name: PROCESS_QUERY_INFORMATION + Type: DWORD +- Name: PROCESS_QUERY_LIMITED_INFORMATION + Type: DWORD +- Name: PROCESS_SUSPEND_RESUME + Type: DWORD +- Name: PROCESS_TERMINATE + Type: DWORD +- Name: PROCESS_VM_OPERATION + Type: DWORD +- Name: PROCESS_VM_READ + Type: DWORD +- Name: PROCESS_VM_WRITE + Type: DWORD +- Name: PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE + Type: DWORD_PTR +- Name: QS_ALLEVENTS + Type: UINT +- Name: QS_ALLINPUT + Type: UINT +- Name: QS_HOTKEY + Type: UINT +- Name: QS_INPUT + Type: UINT +- Name: QS_KEY + Type: UINT +- Name: QS_MOUSE + Type: UINT +- Name: QS_PAINT + Type: UINT +- Name: QS_POINTER + Type: UINT +- Name: QS_POSTMESSAGE + Type: UINT +- Name: QS_RAWINPUT + Type: UINT +- Name: QS_SENDMESSAGE + Type: UINT +- Name: QS_TIMER + Type: UINT +- Name: QS_TOUCH + Type: UINT +- Name: READ_CONTROL + Type: DWORD +- Name: REALTIME_PRIORITY_CLASS + Type: DWORD +- Name: REG_OPTION_NON_VOLATILE + Type: DWORD +- Name: RIGHTMOST_BUTTON_PRESSED + Type: DWORD +- Name: RIGHT_ALT_PRESSED + Type: DWORD +- Name: RIGHT_CTRL_PRESSED + Type: DWORD +- Name: RIP_EVENT + Type: DWORD +- Name: RRF_RT_REG_SZ + Type: DWORD +- Name: RRF_ZEROONFAILURE + Type: DWORD +- Name: SC_MANAGER_CONNECT + Type: DWORD +- Name: SECTION_EXTEND_SIZE + Type: DWORD +- Name: SECTION_MAP_EXECUTE + Type: DWORD +- Name: SECTION_MAP_READ + Type: DWORD +- Name: SECTION_MAP_WRITE + Type: DWORD +- Name: SECTION_QUERY + Type: DWORD +- Name: SECURITY_BUILTIN_DOMAIN_RID + Type: DWORD +- Name: SECURITY_DESCRIPTOR_REVISION + Type: DWORD +- Name: SECURITY_WORLD_RID + Type: DWORD +- Name: SEM_NOGPFAULTERRORBOX + Type: UINT +- Name: SERVICE_QUERY_CONFIG + Type: DWORD +- Name: SE_DACL_PROTECTED + Type: SECURITY_DESCRIPTOR_CONTROL +- Name: SHGFI_EXETYPE + Type: UINT +- Name: SHIFT_PRESSED + Type: DWORD +- Name: STANDARD_RIGHTS_EXECUTE + Type: DWORD +- Name: STANDARD_RIGHTS_READ + Type: DWORD +- Name: STANDARD_RIGHTS_REQUIRED + Type: DWORD +- Name: STANDARD_RIGHTS_WRITE + Type: DWORD +- Name: STARTF_USESHOWWINDOW + Type: DWORD +- Name: STARTF_USESTDHANDLES + Type: DWORD +- Name: STD_ERROR_HANDLE + Type: DWORD +- Name: STD_INPUT_HANDLE + Type: DWORD +- Name: STD_OUTPUT_HANDLE + Type: DWORD +- Name: SUBLANG_DEFAULT + Type: WORD +- Name: SWP_NOACTIVATE + Type: UINT +- Name: SWP_NOZORDER + Type: UINT +- Name: SWP_SHOWWINDOW + Type: UINT +- Name: SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE + Type: DWORD +- Name: SYMBOLIC_LINK_FLAG_DIRECTORY + Type: DWORD +- Name: SYMOPT_DEFERRED_LOADS + Type: DWORD +- Name: SYMOPT_UNDNAME + Type: DWORD +- Name: SYNCHRONIZE + Type: DWORD +- Name: TH32CS_SNAPALL + Type: DWORD +- Name: TH32CS_SNAPHEAPLIST + Type: DWORD +- Name: TH32CS_SNAPMODULE + Type: DWORD +- Name: TH32CS_SNAPPROCESS + Type: DWORD +- Name: TH32CS_SNAPTHREAD + Type: DWORD +- Name: THREAD_GET_CONTEXT + Type: DWORD +- Name: THREAD_QUERY_LIMITED_INFORMATION + Type: DWORD +- Name: THREAD_SUSPEND_RESUME + Type: DWORD +- Name: TME_LEAVE + Type: DWORD +- Name: TOKEN_QUERY + Type: DWORD +- Name: TOKEN_READ + Type: DWORD +- Name: TRUNCATE_EXISTING + Type: DWORD +- Name: UF_DONT_EXPIRE_PASSWD + Type: DWORD +- Name: UF_SCRIPT + Type: DWORD +- Name: UNLOAD_DLL_DEBUG_EVENT + Type: DWORD +- Name: USER_PRIV_USER + Type: DWORD +- Name: VOLUME_NAME_DOS + Type: DWORD +- Name: WAIT_OBJECT_0 + Type: DWORD +- Name: WAIT_TIMEOUT + Type: DWORD +- Name: WER_FAULT_REPORTING_NO_UI + Type: DWORD +- Name: WINDOW_BUFFER_SIZE_EVENT + Type: WORD +- Name: WINEVENT_OUTOFCONTEXT + Type: DWORD +- Name: WM_CLOSE + Type: UINT +- Name: WM_ENTERIDLE + Type: UINT +- Name: WM_GETICON + Type: UINT +- Name: WM_NCHITTEST + Type: UINT +- Name: WM_NCLBUTTONDOWN + Type: UINT +- Name: WM_NCMOUSEMOVE + Type: UINT +- Name: WM_NCRBUTTONUP + Type: UINT +- Name: WM_POWERBROADCAST + Type: UINT +- Name: WM_QUIT + Type: UINT +- Name: WM_SETCURSOR + Type: UINT +- Name: WRITE_DAC + Type: DWORD +- Name: WRITE_OWNER + Type: DWORD +- Name: WSA_FLAG_OVERLAPPED + Type: DWORD +- Name: WS_BORDER + Type: UINT +- Name: WS_CAPTION + Type: UINT +- Name: WS_CHILD + Type: DWORD +- Name: WS_EX_LAYERED + Type: DWORD +- Name: WS_MAXIMIZEBOX + Type: UINT +- Name: WS_MINIMIZEBOX + Type: UINT +- Name: WS_OVERLAPPED + Type: UINT +- Name: WS_OVERLAPPEDWINDOW + Type: UINT +- Name: WS_POPUP + Type: UINT +- Name: WS_POPUPWINDOW + Type: UINT +- Name: WS_SYSMENU + Type: UINT +- Name: WS_THICKFRAME + Type: UINT +- Name: WT_EXECUTEDEFAULT + Type: ULONG +- Name: WT_EXECUTEINIOTHREAD + Type: ULONG +- Name: WT_EXECUTEINPERSISTENTTHREAD + Type: ULONG +- Name: WT_EXECUTEINTIMERTHREAD + Type: ULONG +- Name: WT_EXECUTELONGFUNCTION + Type: ULONG +- Name: WT_EXECUTEONLYONCE + Type: ULONG +- Name: WT_TRANSFER_IMPERSONATION + Type: ULONG diff --git a/stdlib/public/Windows/WinSDK.swift b/stdlib/public/Windows/WinSDK.swift index 0d3218844d0d8..c9c2d2e009240 100644 --- a/stdlib/public/Windows/WinSDK.swift +++ b/stdlib/public/Windows/WinSDK.swift @@ -14,46 +14,12 @@ @_exported import _GUIDDef @_exported import WinSDK // Clang module -// WinBase.h -@inlinable -public var HANDLE_FLAG_INHERIT: DWORD { - 0x00000001 -} - -// WinBase.h -@inlinable -public var STARTF_USESTDHANDLES: DWORD { - 0x00000100 -} - -// WinBase.h -@inlinable -public var INFINITE: DWORD { - DWORD(bitPattern: -1) -} - // WinBase.h @inlinable public var WAIT_OBJECT_0: DWORD { 0 } -// WinBase.h -@inlinable -public var STD_INPUT_HANDLE: DWORD { - DWORD(bitPattern: -10) -} - -@inlinable -public var STD_OUTPUT_HANDLE: DWORD { - DWORD(bitPattern: -11) -} - -@inlinable -public var STD_ERROR_HANDLE: DWORD { - DWORD(bitPattern: -12) -} - // handleapi.h @inlinable public var INVALID_HANDLE_VALUE: HANDLE { @@ -93,17 +59,6 @@ public var FIONBIO: Int32 { Int32(bitPattern: 0x8004667e) } -// WinUser.h -@inlinable -public var CW_USEDEFAULT: Int32 { - Int32(bitPattern: 2147483648) -} - -@inlinable -public var QS_MOUSE: UINT { - UINT(QS_MOUSEMOVE | QS_MOUSEBUTTON) -} - @inlinable public var QS_INPUT: UINT { QS_MOUSE | UINT(QS_KEY | QS_RAWINPUT | QS_TOUCH | QS_POINTER) @@ -129,12 +84,6 @@ public var WS_POPUPWINDOW: UINT { UINT(numericCast(WS_POPUP) | WS_BORDER | WS_SYSMENU) } -// fileapi.h -@inlinable -public var INVALID_FILE_ATTRIBUTES: DWORD { - DWORD(bitPattern: -1) -} - // CommCtrl.h public let WC_BUTTONW: [WCHAR] = Array("Button".utf16) public let WC_COMBOBOXW: [WCHAR] = Array("ComboBox".utf16) diff --git a/stdlib/public/libexec/swift-backtrace/TargetWindows.swift b/stdlib/public/libexec/swift-backtrace/TargetWindows.swift index 6a705cb615682..3ca351548b0ae 100644 --- a/stdlib/public/libexec/swift-backtrace/TargetWindows.swift +++ b/stdlib/public/libexec/swift-backtrace/TargetWindows.swift @@ -230,11 +230,7 @@ class Target { self.pid = pid guard let hProcess = OpenProcess( - DWORD( - PROCESS_VM_READ - | PROCESS_QUERY_LIMITED_INFORMATION - | PROCESS_SUSPEND_RESUME - ), + PROCESS_VM_READ | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_SUSPEND_RESUME, false, pid ) else { @@ -259,11 +255,7 @@ class Target { for thread in threads { guard let hThread = OpenThread( - DWORD( - THREAD_GET_CONTEXT - | THREAD_QUERY_LIMITED_INFORMATION - | THREAD_SUSPEND_RESUME - ), + THREAD_GET_CONTEXT | THREAD_QUERY_LIMITED_INFORMATION | THREAD_SUSPEND_RESUME, false, thread ) else { @@ -493,9 +485,7 @@ class Target { nil, nil, false, - DWORD(NORMAL_PRIORITY_CLASS - | CREATE_NEW_CONSOLE - | CREATE_NEW_PROCESS_GROUP), + NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP, nil, nil, &startupInfo, diff --git a/test/APINotes/Inputs/custom-modules/APINotesTest.apinotes b/test/APINotes/Inputs/custom-modules/APINotesTest.apinotes index d981e5f5f9c8e..d019b2081c289 100644 --- a/test/APINotes/Inputs/custom-modules/APINotesTest.apinotes +++ b/test/APINotes/Inputs/custom-modules/APINotesTest.apinotes @@ -15,6 +15,17 @@ Globals: SwiftName: '`class`' - Name: ANTGlobalValue5 SwiftName: '`3test raw`' + - Name: APINOTES_TYPED_MACRO + Type: APINotesUnsigned + - Name: APINOTES_TYPED_MACRO_ALIAS_TARGET + Type: APINotesSigned + - Name: APINOTES_TYPED_MACRO_ALIAS + Type: APINotesUnsigned + - Name: APINOTES_RENAMED_MACRO + SwiftName: renamedMacroConstant + - Name: APINOTES_RETYPED_RENAMED_MACRO + SwiftName: retypedRenamedMacroConstant + Type: APINotesUnsigned - Name: will_be_private SwiftPrivate: true Tags: diff --git a/test/APINotes/Inputs/custom-modules/APINotesTest.h b/test/APINotes/Inputs/custom-modules/APINotesTest.h index e5cb53ba24419..5aa583fef12c8 100644 --- a/test/APINotes/Inputs/custom-modules/APINotesTest.h +++ b/test/APINotes/Inputs/custom-modules/APINotesTest.h @@ -6,6 +6,13 @@ extern int ANTGlobalValue2; extern int ANTGlobalValue3; extern int ANTGlobalValue4; extern int ANTGlobalValue5; +typedef unsigned APINotesUnsigned; +typedef int APINotesSigned; +#define APINOTES_TYPED_MACRO 42 +#define APINOTES_TYPED_MACRO_ALIAS_TARGET 314 +#define APINOTES_TYPED_MACRO_ALIAS APINOTES_TYPED_MACRO_ALIAS_TARGET +#define APINOTES_RENAMED_MACRO 17 +#define APINOTES_RETYPED_RENAMED_MACRO 19 struct PointStruct { double x, y; diff --git a/test/APINotes/basic.swift b/test/APINotes/basic.swift index cae440ee05bbf..3b85b5c6b84c5 100644 --- a/test/APINotes/basic.swift +++ b/test/APINotes/basic.swift @@ -49,6 +49,19 @@ func testSwiftName() { let d: Double = __will_be_private + let _: APINotesUnsigned = APINOTES_TYPED_MACRO + let _: CInt = APINOTES_TYPED_MACRO // expected-error{{cannot convert value of type 'APINotesUnsigned'}} + let _: APINotesSigned = APINOTES_TYPED_MACRO_ALIAS_TARGET + let _: APINotesUnsigned = APINOTES_TYPED_MACRO_ALIAS_TARGET // expected-error{{cannot convert value of type 'APINotesSigned'}} + let _: APINotesUnsigned = APINOTES_TYPED_MACRO_ALIAS + let _: APINotesSigned = APINOTES_TYPED_MACRO_ALIAS // expected-error{{cannot convert value of type 'APINotesUnsigned'}} + + _ = renamedMacroConstant + _ = APINOTES_RENAMED_MACRO // expected-error{{'APINOTES_RENAMED_MACRO' has been renamed to 'renamedMacroConstant'}} + let _: APINotesUnsigned = retypedRenamedMacroConstant + let _: CInt = retypedRenamedMacroConstant // expected-error{{cannot convert value of type 'APINotesUnsigned'}} + _ = APINOTES_RETYPED_RENAMED_MACRO // expected-error{{'APINOTES_RETYPED_RENAMED_MACRO' has been renamed to 'retypedRenamedMacroConstant'}} + // From APINotesFrameworkTest. jumpTo(x: 0, y: 0, z: 0) jumpTo(0, 0, 0) // expected-error{{missing argument labels 'x:y:z:' in call}} diff --git a/test/APINotes/macro_constant_values.swift b/test/APINotes/macro_constant_values.swift new file mode 100644 index 0000000000000..4ff16e19315a1 --- /dev/null +++ b/test/APINotes/macro_constant_values.swift @@ -0,0 +1,31 @@ +// RUN: %target-swift-frontend -I %S/Inputs/custom-modules -emit-sil -Xllvm -sil-disable-pass=Simplification -Xllvm -sil-print-types -Xllvm -sil-print-debuginfo %s | %FileCheck %s + +import APINotesTest + +// CHECK-LABEL: // typedMacro() +func typedMacro() -> APINotesUnsigned { + // CHECK: integer_literal $Builtin.Int32, 42 + // CHECK: struct $UInt32 + APINOTES_TYPED_MACRO +} + +// CHECK-LABEL: // typedMacroAlias() +func typedMacroAlias() -> APINotesUnsigned { + // CHECK: integer_literal $Builtin.Int32, 314 + // CHECK: struct $UInt32 + APINOTES_TYPED_MACRO_ALIAS +} + +// CHECK-LABEL: // renamedMacro() +func renamedMacro() -> CInt { + // CHECK: integer_literal $Builtin.Int32, 17 + // CHECK: struct $Int32 + renamedMacroConstant +} + +// CHECK-LABEL: // retypedRenamedMacro() +func retypedRenamedMacro() -> APINotesUnsigned { + // CHECK: integer_literal $Builtin.Int32, 19 + // CHECK: struct $UInt32 + retypedRenamedMacroConstant +} diff --git a/test/ClangImporter/macro_integer_casts.swift b/test/ClangImporter/macro_integer_casts.swift new file mode 100644 index 0000000000000..d720d990c13b9 --- /dev/null +++ b/test/ClangImporter/macro_integer_casts.swift @@ -0,0 +1,7 @@ +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -verify + +import macros + +let _: CUnsignedInt = CAST_UNSIGNED_MINUS_ONE +let _: CUnsignedInt = CAST_UNSIGNED_MINUS_TEN +let _: TEST_DWORD = CAST_TYPEDEF_UNSIGNED_MINUS_ONE diff --git a/test/ClangImporter/macro_literals.swift b/test/ClangImporter/macro_literals.swift index 7a47cdb48ba74..8312455569aff 100644 --- a/test/ClangImporter/macro_literals.swift +++ b/test/ClangImporter/macro_literals.swift @@ -116,6 +116,21 @@ func testIntegerArithmetic() { _ = DIVIDE_MIXED_TYPES as CLongLong } +// CHECK-LABEL: // testCStyleIntegerCasts() +func testCStyleIntegerCasts() { + // CHECK: %[[P0:.*]] = integer_literal $Builtin.Int32, -1, loc {{.*}} + // CHECK: %{{.*}} = struct $UInt32 (%[[P0]] : $Builtin.Int32), loc {{.*}} + _ = CAST_UNSIGNED_MINUS_ONE as CUnsignedInt + + // CHECK: %[[P1:.*]] = integer_literal $Builtin.Int32, -10, loc {{.*}} + // CHECK: %{{.*}} = struct $UInt32 (%[[P1]] : $Builtin.Int32), loc {{.*}} + _ = CAST_UNSIGNED_MINUS_TEN as CUnsignedInt + + // CHECK: %[[P2:.*]] = integer_literal $Builtin.Int32, -1, loc {{.*}} + // CHECK: %{{.*}} = struct $UInt32 (%[[P2]] : $Builtin.Int32), loc {{.*}} + _ = CAST_TYPEDEF_UNSIGNED_MINUS_ONE as TEST_DWORD +} + // CHECK-LABEL: // testIntegerComparisons() func testIntegerComparisons() { diff --git a/test/Inputs/clang-importer-sdk/usr/include/macros.h b/test/Inputs/clang-importer-sdk/usr/include/macros.h index 3174848046826..57e7ec154045d 100644 --- a/test/Inputs/clang-importer-sdk/usr/include/macros.h +++ b/test/Inputs/clang-importer-sdk/usr/include/macros.h @@ -115,6 +115,12 @@ #define DIVIDE_MIXED_TYPES (INT64_MAX / UINT32_MAX) // Result = (2^31)LL #define DIVIDE_INVALID (69 / 0) // Should skip. Divide by zero. +typedef unsigned int TEST_DWORD; + +#define CAST_UNSIGNED_MINUS_ONE ((unsigned)-1) +#define CAST_UNSIGNED_MINUS_TEN ((unsigned)-10) +#define CAST_TYPEDEF_UNSIGNED_MINUS_ONE ((TEST_DWORD)-1) + // Integer Comparisons. #define EQUAL_FALSE (99 == 66) diff --git a/test/stdlib/WinSDK_APINotes.swift b/test/stdlib/WinSDK_APINotes.swift new file mode 100644 index 0000000000000..ded0bf9dd8026 --- /dev/null +++ b/test/stdlib/WinSDK_APINotes.swift @@ -0,0 +1,14 @@ +// RUN: %target-typecheck-verify-swift +// REQUIRES: OS=windows-msvc + +import WinSDK + +let _: DWORD = HANDLE_FLAG_INHERIT +let _: DWORD = INFINITE +let _: DWORD = INVALID_FILE_ATTRIBUTES +let _: UINT = QS_MOUSE +let _: DWORD = STARTF_USESTDHANDLES +let _: DWORD = STD_ERROR_HANDLE +let _: DWORD = STD_INPUT_HANDLE +let _: DWORD = STD_OUTPUT_HANDLE +let _: Int32 = CW_USEDEFAULT diff --git a/tools/swift-inspect/Sources/swift-inspect/Process.swift b/tools/swift-inspect/Sources/swift-inspect/Process.swift index f0d41fe27a2cb..271ce66b584b2 100644 --- a/tools/swift-inspect/Sources/swift-inspect/Process.swift +++ b/tools/swift-inspect/Sources/swift-inspect/Process.swift @@ -109,7 +109,7 @@ internal func process(matching: String) -> ProcessIdentifier? { return dwProcess } - let hSnapshot = CreateToolhelp32Snapshot(DWORD(TH32CS_SNAPPROCESS), 0) + let hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) if hSnapshot == INVALID_HANDLE_VALUE { return nil } diff --git a/tools/swift-inspect/Sources/swift-inspect/WindowsRemoteProcess.swift b/tools/swift-inspect/Sources/swift-inspect/WindowsRemoteProcess.swift index 560c2b4c0cb91..9f09f475a7edf 100644 --- a/tools/swift-inspect/Sources/swift-inspect/WindowsRemoteProcess.swift +++ b/tools/swift-inspect/Sources/swift-inspect/WindowsRemoteProcess.swift @@ -138,11 +138,8 @@ internal final class WindowsRemoteProcess: RemoteProcess { self.processIdentifier = processId // Get process handle. guard let process = - OpenProcess( - DWORD( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION), - false, - processId) else { + OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, + false, processId) else { return nil } self.process = process @@ -284,7 +281,7 @@ internal final class WindowsRemoteProcess: RemoteProcess { let hMapFile = CreateFileMappingA( INVALID_HANDLE_VALUE, nil, - DWORD(PAGE_READWRITE), + PAGE_READWRITE, 0, DWORD(bufSize), sharedMemoryName) @@ -588,22 +585,21 @@ internal final class WindowsRemoteProcess: RemoteProcess { print("\(String(decodingCString: $0.baseAddress!, as: UTF16.self)) doesn't exist") return nil } - guard faAttributes.dwFileAttributes & DWORD(FILE_ATTRIBUTE_REPARSE_POINT) == 0 else { + guard faAttributes.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT == 0 else { print("\(String(decodingCString: $0.baseAddress!, as: UTF16.self)) doesn't exist") return nil } let szLength = SIZE_T(Int(dwLength) * MemoryLayout.size) guard let pAllocation = - VirtualAllocEx(self.process, nil, szLength, - DWORD(MEM_COMMIT), DWORD(PAGE_READWRITE)) else { + VirtualAllocEx(self.process, nil, szLength, MEM_COMMIT, PAGE_READWRITE) else { print("VirtualAllocEx failed \(GetLastError())") return nil } if !WriteProcessMemory(self.process, pAllocation, $0.baseAddress, szLength, nil) { print("WriteProcessMemory failed \(GetLastError())") - _ = VirtualFreeEx(self.process, pAllocation, 0, DWORD(MEM_RELEASE)) + _ = VirtualFreeEx(self.process, pAllocation, 0, MEM_RELEASE) return nil } @@ -620,7 +616,7 @@ internal final class WindowsRemoteProcess: RemoteProcess { from process: DWORD, _ pfnFunction: LPTHREAD_START_ROUTINE) -> Bool { // Deallocate the dll path string in the remote process - if !VirtualFreeEx(self.process, pwszModule, 0, DWORD(MEM_RELEASE)) { + if !VirtualFreeEx(self.process, pwszModule, 0, MEM_RELEASE) { print("VirtualFreeEx failed: \(GetLastError())") } @@ -662,7 +658,7 @@ internal final class WindowsRemoteProcess: RemoteProcess { private func modules(of dwProcessId: DWORD, _ closure: (MODULEENTRY32W, String) -> Void) { let hModuleSnapshot: HANDLE = - CreateToolhelp32Snapshot(DWORD(TH32CS_SNAPMODULE), dwProcessId) + CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId) if hModuleSnapshot == INVALID_HANDLE_VALUE { print("CreateToolhelp32Snapshot failed \(GetLastError())") return @@ -785,7 +781,7 @@ extension String { } func enumerateThreads(processIdentifier: DWORD, dwDesiredAccess: DWORD, _ block: (HANDLE) throws -> ()) throws { - let hThreadSnap = CreateToolhelp32Snapshot(DWORD(TH32CS_SNAPTHREAD), 0) + let hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0) if hThreadSnap == INVALID_HANDLE_VALUE { throw _Win32Error(functionName: "CreateToolhelp32Snapshot", error: GetLastError()) } diff --git a/utils/update_checkout/update-checkout-config.json b/utils/update_checkout/update-checkout-config.json index 2545e1dcce775..8c8c235221bc2 100644 --- a/utils/update_checkout/update-checkout-config.json +++ b/utils/update_checkout/update-checkout-config.json @@ -154,7 +154,7 @@ "swift-tools-protocols": "main", "swift-tools-support-core": "main", "swiftpm": "main", - "swift-argument-parser": "1.6.1", + "swift-argument-parser": "1.7.2", "swift-atomics": "1.3.1", "swift-collections": "1.1.6", "swift-crypto": "3.12.5", @@ -165,7 +165,7 @@ "swift-log": "1.5.4", "swift-numerics": "1.0.2", "swift-syntax": "main", - "swift-system": "1.5.0", + "swift-system": "1.6.6", "swift-stress-tester": "main", "swift-testing": "main", "swift-corelibs-xctest": "main", @@ -829,7 +829,7 @@ "swift-tools-protocols": "main", "swift-tools-support-core": "main", "swiftpm": "main", - "swift-argument-parser": "1.6.1", + "swift-argument-parser": "1.7.2", "swift-atomics": "1.3.1", "swift-collections": "1.1.6", "swift-crypto": "3.12.5", @@ -840,7 +840,7 @@ "swift-log": "1.5.4", "swift-numerics": "1.0.2", "swift-syntax": "main", - "swift-system": "1.5.0", + "swift-system": "1.6.6", "swift-stress-tester": "main", "swift-testing": "main", "swift-corelibs-xctest": "main",