Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,3 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
/Sampler
2 changes: 1 addition & 1 deletion AcousticEchoCancellation/AECCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public CAECCapture()
// Set the category as communications.
AudioClientProperties clientProperties = new()
{
cbSize = (uint)Marshal.SizeOf(typeof(AudioClientProperties)),
cbSize = (uint)Marshal.SizeOf<AudioClientProperties>(),
eCategory = AUDIO_STREAM_CATEGORY.AudioCategory_Communications
};
audioClient.SetClientProperties(clientProperties);
Expand Down
2 changes: 1 addition & 1 deletion CimFSAPI/app.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ static void ValidateHardLinkInCim([In] string cimPath, [In] string imageName, [I
CimFileData cimFileData = GetFileData(cimFilePath);
CimFileData cimLinkData = GetFileData(cimLinkPath);

if (Interop.memcmp(cimFileData.FileIdInfo.FileId.Identifier, cimLinkData.FileIdInfo.FileId.Identifier, Marshal.SizeOf(typeof(FILE_ID_128))) != 0)
if (Interop.memcmp(cimFileData.FileIdInfo.FileId.Identifier, cimLinkData.FileIdInfo.FileId.Identifier, Marshal.SizeOf<FILE_ID_128>()) != 0)
{
Console.Error.WriteLine("did not match");
}
Expand Down
2 changes: 1 addition & 1 deletion CustomResourceManager/CSecInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public HRESULT SetSecurity(SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR pSD)
if (destDacl.IsNull)
{
// Align sizeNeeded to a uint
var dwSizeNeeded = (Marshal.SizeOf(typeof(ACL)) + (Marshal.SizeOf(typeof(uint)) - 1)) & 0xfffffffc;
var dwSizeNeeded = (Marshal.SizeOf<ACL>() + (Marshal.SizeOf<uint>() - 1)) & 0xfffffffc;

pDestDacl = new SafePACL((int)dwSizeNeeded);
}
Expand Down
2 changes: 1 addition & 1 deletion CustomResourceManager/utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static HRESULT ACEAlreadyInACL(in PACL acl, in PACE ace, out bool lpbAceP
continue;
}

var result = memcmp(sidStart1, sidStart2, aceSize - Marshal.SizeOf(typeof(ACE_HEADER)) - Marshal.SizeOf(typeof(ACCESS_MASK)));
var result = memcmp(sidStart1, sidStart2, aceSize - Marshal.SizeOf<ACE_HEADER>() - Marshal.SizeOf<ACCESS_MASK>());
if (result == 0)
{
lpbAcePresent = true;
Expand Down
2 changes: 1 addition & 1 deletion DPIAwarenessPerWindow/client/DpiAwarenessContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private static void ShowFileOpenDialog(HWND hWnd)
SafeLPTSTR szFile = new(MAX_PATH); // buffer for file name
OPENFILENAME ofn = new()
{
lStructSize = (uint)Marshal.SizeOf(typeof(OPENFILENAME)),
lStructSize = (uint)Marshal.SizeOf<OPENFILENAME>(),
hwndOwner = hWnd,
lpstrFile = szFile,
nMaxFile = (uint)szFile.Capacity,
Expand Down
Binary file modified DPIAwarenessPerWindow/client/DpiAwarenessContextRes.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions DXGIDesktopDuplication/DisplayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public DUPL_RETURN ProcessFrame(in FRAME_DATA Data, [In, Out] ID3D11Texture2D Sh
}
if (Data.DirtyCount != 0)
{
Ret = CopyDirty(Data.Frame, SharedSurf, Data.MetaData.Offset(Data.MoveCount * Marshal.SizeOf(typeof(DXGI_OUTDUPL_MOVE_RECT))).ToArray<RECT>(Data.DirtyCount)!, Data.DirtyCount, OffsetX, OffsetY, DeskDesc);
Ret = CopyDirty(Data.Frame, SharedSurf, Data.MetaData.Offset(Data.MoveCount * Marshal.SizeOf<DXGI_OUTDUPL_MOVE_RECT>()).ToArray<RECT>(Data.DirtyCount)!, Data.DirtyCount, OffsetX, OffsetY, DeskDesc);
}
}
return Ret;
Expand Down Expand Up @@ -341,7 +341,7 @@ DUPL_RETURN CopyDirty([In] ID3D11Texture2D SrcSurface, [In, Out] ID3D11Texture2D
{
return ProcessFailure(m_Device, "Failed to create vertex buffer in dirty rect processing", "Error", hr, SystemTransitionsExpectedErrors);
}
uint Stride = (uint)Marshal.SizeOf(typeof(VERTEX));
uint Stride = (uint)Marshal.SizeOf<VERTEX>();
uint Offset = 0;
m_DeviceContext.IASetVertexBuffers(0, 1, [VertBuf!], [Stride], [Offset]);

Expand Down
4 changes: 2 additions & 2 deletions DXGIDesktopDuplication/DuplicationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public DUPL_RETURN GetFrame(out FRAME_DATA Data, out bool Timeout)
Data.DirtyCount = 0;
return ProcessFailure(default, "Failed to get frame move rects in DUPLICATIONMANAGER", "Error", hr, FrameInfoExpectedErrors);
}
Data.MoveCount = (int)BufSize / Marshal.SizeOf(typeof(DXGI_OUTDUPL_MOVE_RECT));
Data.MoveCount = (int)BufSize / Marshal.SizeOf<DXGI_OUTDUPL_MOVE_RECT>();

IntPtr DirtyRects = m_MetaDataBuffer.Offset(BufSize);
BufSize = FrameInfo.TotalMetadataBufferSize - BufSize;
Expand All @@ -215,7 +215,7 @@ public DUPL_RETURN GetFrame(out FRAME_DATA Data, out bool Timeout)
Data.DirtyCount = 0;
return ProcessFailure(default, "Failed to get frame dirty rects in DUPLICATIONMANAGER", "Error", hr, FrameInfoExpectedErrors);
}
Data.DirtyCount = (int)BufSize / Marshal.SizeOf(typeof(RECT));
Data.DirtyCount = (int)BufSize / Marshal.SizeOf<RECT>();

Data.MetaData = m_MetaDataBuffer;
}
Expand Down
12 changes: 6 additions & 6 deletions DXGIDesktopDuplication/OutputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ DUPL_RETURN DrawFrame()
}

// Set resources
uint Stride = (uint)Marshal.SizeOf(typeof(VERTEX));
uint Stride = (uint)Marshal.SizeOf<VERTEX>();
uint Offset = 0;
float[] blendFactor = [0.0f, 0.0f, 0.0f, 0.0f];
m_DeviceContext!.OMSetBlendState(default, blendFactor, 0xffffffff);
Expand All @@ -451,7 +451,7 @@ DUPL_RETURN DrawFrame()
D3D11_BUFFER_DESC BufferDesc = new()
{
Usage = D3D11_USAGE.D3D11_USAGE_DEFAULT,
ByteWidth = (uint)(Marshal.SizeOf(typeof(VERTEX)) * NUMVERTICES),
ByteWidth = (uint)(Marshal.SizeOf<VERTEX>() * NUMVERTICES),
BindFlags = D3D11_BIND_FLAG.D3D11_BIND_VERTEX_BUFFER,
CPUAccessFlags = 0
};
Expand Down Expand Up @@ -581,7 +581,7 @@ DUPL_RETURN ProcessMonoMask(bool IsMono, [In, Out] ref PTR_INFO PtrInfo, out int
return ProcessFailure(default, "Failed to allocate memory for new mouse shape buffer.", "Error", HRESULT.E_OUTOFMEMORY);
}

uint DesktopPitchInPixels = (uint)MappedSurface.Pitch / (uint)Marshal.SizeOf(typeof(uint));
uint DesktopPitchInPixels = (uint)MappedSurface.Pitch / (uint)Marshal.SizeOf<uint>();

// What to skip (pixel offset)
int SkipX = (GivenLeft < 0) ? (-1 * GivenLeft) : (0);
Expand Down Expand Up @@ -628,7 +628,7 @@ DUPL_RETURN ProcessMonoMask(bool IsMono, [In, Out] ref PTR_INFO PtrInfo, out int
for (int Col = 0; Col < PtrWidth; ++Col)
{
// Set up mask
uint MaskVal = 0xFF000000 & Buffer32[(Col + SkipX) + ((Row + SkipY) * (PtrInfo.ShapeInfo.Pitch / Marshal.SizeOf(typeof(uint))))];
uint MaskVal = 0xFF000000 & Buffer32[(Col + SkipX) + ((Row + SkipY) * (PtrInfo.ShapeInfo.Pitch / Marshal.SizeOf<uint>()))];
if (MaskVal != 0)
{
// Mask was 0xFF
Expand Down Expand Up @@ -780,7 +780,7 @@ DUPL_RETURN DrawMouse(PTR_INFO PtrInfo)
D3D11_BUFFER_DESC BDesc = new()
{
Usage = D3D11_USAGE.D3D11_USAGE_DEFAULT,
ByteWidth = (uint)Marshal.SizeOf(typeof(VERTEX)) * NUMVERTICES,
ByteWidth = (uint)Marshal.SizeOf<VERTEX>() * NUMVERTICES,
BindFlags = D3D11_BIND_FLAG.D3D11_BIND_VERTEX_BUFFER,
CPUAccessFlags = 0
};
Expand All @@ -800,7 +800,7 @@ DUPL_RETURN DrawMouse(PTR_INFO PtrInfo)

// Set resources
float[] BlendFactor = new float[4];
uint Stride = (uint)Marshal.SizeOf(typeof(VERTEX));
uint Stride = (uint)Marshal.SizeOf<VERTEX>();
uint Offset = 0;
m_DeviceContext!.IASetVertexBuffers(0, 1, [VertexBufferMouse!], [Stride], [Offset]);
m_DeviceContext.OMSetBlendState(m_BlendState, BlendFactor, 0xFFFFFFFF);
Expand Down
2 changes: 1 addition & 1 deletion DataDedupBackupRestore/DedupBackupRestore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ private static HRESULT GetEventData([In] EVT_HANDLE _event, string dataName, out

properties = (PEVT_VARIANT)eventDataBuffer;

result = EvtRender(renderContext, _event, EvtRenderEventValues, Marshal.SizeOf(typeof(eventDataBuffer)), properties, out bufferUsed, out propertyCount);
result = EvtRender(renderContext, _event, EvtRenderEventValues, Marshal.SizeOf<eventDataBuffer>(), properties, out bufferUsed, out propertyCount);
}
}

Expand Down
2 changes: 1 addition & 1 deletion DesktopAutomationDismiss/ShowDesktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private static void ShowDesktop()
new INPUT { type = INPUTTYPE.INPUT_KEYBOARD, ki = new KEYBDINPUT { wVk = VK_LWIN, dwFlags = KEYEVENTF.KEYEVENTF_KEYUP } },
};

if (SendInput((uint)inputs.Length, inputs, Marshal.SizeOf(typeof(INPUT))) != (uint)inputs.Length)
if (SendInput((uint)inputs.Length, inputs, Marshal.SizeOf<INPUT>()) != (uint)inputs.Length)
{
OutputString("SendInput failed: {0}\n", Win32Error.GetLastError().ToHRESULT());
}
Expand Down
2 changes: 1 addition & 1 deletion DirectX-Graphics-Samples/D3D1211On12/D3D1211On12.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private void LoadAssets()

// Initialize the vertex buffer view.
m_vertexBufferView.BufferLocation = m_vertexBuffer.GetGPUVirtualAddress();
m_vertexBufferView.StrideInBytes = (uint)Marshal.SizeOf(typeof(Vertex));
m_vertexBufferView.StrideInBytes = (uint)Marshal.SizeOf<Vertex>();
m_vertexBufferView.SizeInBytes = vertexBufferSize;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void LoadAssets()

// Initialize the vertex buffer views.
m_vertexBufferView.BufferLocation = m_vertexBuffer!.GetGPUVirtualAddress();
m_vertexBufferView.StrideInBytes = (uint)Marshal.SizeOf(typeof(Vertex));
m_vertexBufferView.StrideInBytes = (uint)Marshal.SizeOf<Vertex>();
m_vertexBufferView.SizeInBytes = vertexBufferSize;
}

Expand Down
Loading