You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was found in my projection because I have a function GetChildType that runs on every parameter type with NativeArrayInfo. All other parameter types that use it are some sort of pointer type.
private TypeRef GetChildType(TypeRefDecoderdecoder){if(thisis TypeRef.PointerTo pointerTo){return pointerTo.ChildType;}if(object.ReferenceEquals(this, Primitive.IntPtr)){return Primitive.Void;}if(thisis TypeRef.User userType){if(userType.Info.Fqn =="Windows.Win32.Foundation.PSTR"){return TypeRef.Primitive.Byte;}if(userType.Info.Fqn =="Windows.Win32.Foundation.PWSTR"){return TypeRef.Primitive.Char;}// This is the type of a parameter for PxeProviderSetAttribute that changes dynamically depending on another// parameter, so we'll just default to representing it as a Byte array.if(userType.Info.Fqn =="Windows.Win32.WindowsDeploymentServices.PxeProviderSetAttribute_pParameterBufferFlags"){return TypeRef.Primitive.Byte;}// I think this is an array of bytes based on https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getpath// aj: A pointer to an array of bytes that receives the vertex types.if(userType.Info.Fqn =="Windows.Win32.Gdi.GetPath_aj"){return TypeRef.Primitive.Byte;}if(userType.Info.Fqn =="Windows.Win32.Security.PSID"){return decoder.GetTypeFromNamespaceAndNameInThisModule("Windows.Win32.Security","SID");}}throw Violation.Data();}
The text was updated successfully, but these errors were encountered:
This took me a few minutes to figure out what was going on! The SAL is incorrect for pAdapter. It's not an array, it's meant to be a single adapter, which is what the metadata is doing. The count is referring to how many "new interfaces" (whatever that means) are to be added to the single adapter. I looked at the implementation to make sure this is the case. The fix would be to get rid of the "[NativeArrayInfo(CountParamIndex = 1)]" attribute. If it were an actual array, the C declaration would be INetCfgComponent **pAdapter.
The first parameter
pAdapter
in the functionAddInterfacesToAdapter
hasNativeArrayInfo
but it's not defined as a pointer.Also note that it's a pointer in the native interface:
https://docs.microsoft.com/en-us/previous-versions/windows/hardware/network/ff547809(v=vs.85)
This was found in my projection because I have a function
GetChildType
that runs on every parameter type withNativeArrayInfo
. All other parameter types that use it are some sort of pointer type.https://github.com/marlersoft/win32jsongen/blob/16f9bb264b1534dbd90e376ffcb2a5d8bf422039/Generator/TypeRef.cs#L23
The text was updated successfully, but these errors were encountered: