98 references to NativeMethods
Microsoft.Build.Tasks.Core (86)
AssemblyDependency\AssemblyInformation.cs (3)
365if (NativeMethods.TryReadMetadataString(_sourceFile, data, valueLen, out string propertyValue)) 674uint hresult = NativeMethods.GetFileVersion(path, runtimeVersion, bufferLength, out int dwLength); 684hresult = NativeMethods.GetFileVersion(path, runtimeVersion, bufferLength, out dwLength);
AssemblyDependency\GlobalAssemblyCache.cs (5)
106return new NativeMethods.AssemblyCacheEnum(strongName); 187uint hr = NativeMethods.CreateAssemblyCache(out IAssemblyCache assemblyCache, 0); 208value = NativeMethods.AssemblyCacheEnum.AssemblyPathFromStrongName(strongName); 387NativeMethods.GetCachePath(AssemblyCacheFlags.GAC, null, ref gacPathLength); 389NativeMethods.GetCachePath(AssemblyCacheFlags.GAC, gacPath, ref gacPathLength);
AssemblyDependency\ReferenceTable.cs (9)
2906if (machineType == NativeMethods.IMAGE_FILE_MACHINE_INVALID) 2913case NativeMethods.IMAGE_FILE_MACHINE_AMD64: 2916case NativeMethods.IMAGE_FILE_MACHINE_ARM: 2917case NativeMethods.IMAGE_FILE_MACHINE_ARMV7: 2920case NativeMethods.IMAGE_FILE_MACHINE_ARM64: 2923case NativeMethods.IMAGE_FILE_MACHINE_I386: 2926case NativeMethods.IMAGE_FILE_MACHINE_IA64: 2929case NativeMethods.IMAGE_FILE_MACHINE_UNKNOWN: 2994UInt16 machineType = NativeMethods.IMAGE_FILE_MACHINE_INVALID;
ComDependencyWalker.cs (7)
211if ((typeAttributes.guid == NativeMethods.IID_IUnknown) || 212(typeAttributes.guid == NativeMethods.IID_IDispatch) || 213(typeAttributes.guid == NativeMethods.IID_IDispatchEx) || 214(typeAttributes.guid == NativeMethods.IID_IEnumVariant) || 215(typeAttributes.guid == NativeMethods.IID_ITypeInfo)) 221if (typeLibAttributes.guid == NativeMethods.IID_StdOle) 234typeLib2.GetCustData(ref NativeMethods.GUID_ExportedFromComPlus, out object exportedFromComPlusObj);
ComReference.cs (4)
86ado27 = (ITypeLib)NativeMethods.LoadRegTypeLib(ref s_guidADO27, 2, 7, 0); 251typeLib2.GetCustData(ref NativeMethods.GUID_TYPELIB_NAMESPACE, out object data); 300typeLib = (ITypeLib)NativeMethods.LoadRegTypeLib(ref attr.guid, attr.wMajorVerNum, attr.wMinorVerNum, attr.lcid); 452typeLibPath = NativeMethods.QueryPathOfRegTypeLib(ref typeLibAttr.guid, typeLibAttr.wMajorVerNum, typeLibAttr.wMinorVerNum, typeLibAttr.lcid);
ComReferenceInfo.cs (8)
156this.typeLibPointer = (ITypeLib)NativeMethods.LoadTypeLibEx(path, (int)NativeMethods.REGKIND.REGKIND_NONE | (int)NativeMethods.REGKIND.REGKIND_LOAD_TLB_AS_64BIT); 159this.typeLibPointer = (ITypeLib)NativeMethods.LoadTypeLibEx(path, (int)NativeMethods.REGKIND.REGKIND_NONE | (int)NativeMethods.REGKIND.REGKIND_LOAD_TLB_AS_32BIT); 165this.typeLibPointer = (ITypeLib)NativeMethods.LoadTypeLibEx(path, (int)NativeMethods.REGKIND.REGKIND_NONE);
Copy.cs (3)
332TryCopyViaLink(HardLinkComment, MessageImportance.Normal, sourceFileState, destinationFileState, out hardLinkCreated, ref errorMessage, (source, destination, errMessage) => NativeMethods.MakeHardLink(destination, source, ref errorMessage, Log)); 980if (code == NativeMethods.ERROR_ACCESS_DENIED) 998else if (code == NativeMethods.ERROR_INVALID_FILENAME)
Exec.cs (2)
326if (ExitCode == NativeMethods.SE_ERR_ACCESSDENIED) 468if (workingDirectoryIsUNC && NativeMethods.AllDrivesMapped())
Move.cs (5)
31private const NativeMethods.MoveFileFlags Flags = NativeMethods.MoveFileFlags.MOVEFILE_WRITE_THROUGH | // Do not return until the Move is complete 32NativeMethods.MoveFileFlags.MOVEFILE_REPLACE_EXISTING | // Replace any existing target 33NativeMethods.MoveFileFlags.MOVEFILE_COPY_ALLOWED; // Moving across volumes is allowed 250bool result = NativeMethods.MoveFileEx(sourceFile, destinationFile, Flags);
RegisterAssembly.cs (3)
269typeLib = (ITypeLib)NativeMethods.LoadTypeLibEx(typeLibPath, (int)NativeMethods.REGKIND.REGKIND_NONE); 272NativeMethods.RegisterTypeLib(typeLib, typeLibPath, null);
StrongNameUtils.cs (31)
141IntPtr fileHandle = NativeMethods.InvalidIntPtr; 146fileHandle = NativeMethods.CreateFile(assemblyPath, NativeMethods.GENERIC_READ, FileShare.Read, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero); 147if (fileHandle == NativeMethods.InvalidIntPtr) 153if (NativeMethods.GetFileType(fileHandle) != NativeMethods.FILE_TYPE_DISK) 162fileMappingHandle = NativeMethods.CreateFileMapping(fileHandle, IntPtr.Zero, NativeMethods.PAGE_READONLY, 0, 0, null); 172fileMappingBase = NativeMethods.MapViewOfFile(fileMappingHandle, NativeMethods.FILE_MAP_READ, 0, 0, IntPtr.Zero); 179IntPtr ntHeader = NativeMethods.ImageNtHeader(fileMappingBase); 193IntPtr cor20HeaderPtr = NativeMethods.ImageRvaToVa(ntHeader, fileMappingBase, cor20HeaderRva, out _); 200NativeMethods.IMAGE_COR20_HEADER cor20Header = (NativeMethods.IMAGE_COR20_HEADER)Marshal.PtrToStructure(cor20HeaderPtr, typeof(NativeMethods.IMAGE_COR20_HEADER)); 210if ((cor20Header.Flags & NativeMethods.COMIMAGE_FLAGS_STRONGNAMESIGNED) != 0) 224NativeMethods.UnmapViewOfFile(fileMappingBase); 233NativeMethods.CloseHandle(fileMappingHandle); 240if (fileHandle != NativeMethods.InvalidIntPtr) 242NativeMethods.CloseHandle(fileHandle); 259ushort optionalHeaderMagic = (ushort)Marshal.ReadInt16(ntHeadersPtr, Marshal.SizeOf<uint>() + Marshal.SizeOf<NativeMethods.IMAGE_FILE_HEADER>()); 266if (optionalHeaderMagic == NativeMethods.IMAGE_NT_OPTIONAL_HDR32_MAGIC) 269NativeMethods.IMAGE_NT_HEADERS32 ntHeader32 = (NativeMethods.IMAGE_NT_HEADERS32)Marshal.PtrToStructure(ntHeadersPtr, typeof(NativeMethods.IMAGE_NT_HEADERS32)); 270cor20DataDirectoryLong = ntHeader32.optionalHeader.DataDirectory[NativeMethods.IMAGE_DIRECTORY_ENTRY_COMHEADER]; 272else if (optionalHeaderMagic == NativeMethods.IMAGE_NT_OPTIONAL_HDR64_MAGIC) 275NativeMethods.IMAGE_NT_HEADERS64 ntHeader64 = (NativeMethods.IMAGE_NT_HEADERS64)Marshal.PtrToStructure(ntHeadersPtr, typeof(NativeMethods.IMAGE_NT_HEADERS64)); 276cor20DataDirectoryLong = ntHeader64.optionalHeader.DataDirectory[NativeMethods.IMAGE_DIRECTORY_ENTRY_COMHEADER];
UnregisterAssembly.cs (5)
235ITypeLib typeLibrary = (ITypeLib)NativeMethods.LoadTypeLibEx(typeLibPath, (int)NativeMethods.REGKIND.REGKIND_NONE); 247NativeMethods.UnregisterTypeLib(ref tlibattr.guid, tlibattr.wMajorVerNum, tlibattr.wMinorVerNum, tlibattr.lcid, tlibattr.syskind); 259if (ex.ErrorCode == NativeMethods.TYPE_E_REGISTRYACCESS) 264else if (ex.ErrorCode == NativeMethods.TYPE_E_CANTLOADLIBRARY)
XamlTaskFactory\XamlDataDrivenToolTask.cs (1)
294if (ExitCode == NativeMethods.SE_ERR_ACCESSDENIED)
Microsoft.Build.Tasks.UnitTests (12)
AssemblyDependency\ResolveAssemblyReferenceTestFixture.cs (11)
19using NativeMethods = Microsoft.Build.Tasks.NativeMethods; 675return NativeMethods.IMAGE_FILE_MACHINE_INVALID; 679return NativeMethods.IMAGE_FILE_MACHINE_AMD64; 683return NativeMethods.IMAGE_FILE_MACHINE_I386; 687return NativeMethods.IMAGE_FILE_MACHINE_ARM; 691return NativeMethods.IMAGE_FILE_MACHINE_ARMV7; 695return NativeMethods.IMAGE_FILE_MACHINE_IA64; 699return NativeMethods.IMAGE_FILE_MACHINE_R4000; 703return NativeMethods.IMAGE_FILE_MACHINE_UNKNOWN; 707return NativeMethods.IMAGE_FILE_MACHINE_I386; 710return NativeMethods.IMAGE_FILE_MACHINE_INVALID;
Copy_Tests.cs (1)
2753Tasks.NativeMethods.MakeHardLink(destLink, sourceFile, ref linkError, t.Log);