Wine and SAFEARRAY release

Questions about Wine on Linux
Post Reply
sinsin
Newbie
Newbie
Posts: 3
Joined: Tue Apr 01, 2025 4:11 am

Wine and SAFEARRAY release

Post by sinsin »

Hello

I have a question about how WINE processes marshalling between .Net Core code and COM object.

There is an application, which runs in x64 prefix. Application contains COM object and .Net Core user interface. Data between the com object and the UI are transmitted in structures, which contains safearrays of other structures, some of structures include BSTRs.

Some example of code is listed below:

Code: Select all


typedef [uuid(59d7e939-2a40-4d4c-a750-e8bd85f08a77)]
struct stLimitsSettings
{
	float AbortMinus;
	float AbortPlus;
	float MaxDriveVoltage;
	float MaxShakerAcc;
	float MaxShakerDisp;
	float MaxShakerVel;
	float MaxVDivGForRunning;
	float MaxVDivGForStartup;
	int PhusicalUnitIndex;
	float ProductMass;
	BSTR ShakerProducerName;
	enLimitAndLevelUnitType TolAndAbortUnits;
	float TolMinus;
	float TolPlus;
	int UnexceedLimitsNum;	
	float UnExceedAverAlpha;	
	float UnExceedStableLinePrec;
	BSTR ShakerModelName;
	BOOL CheckShakerLimits;
	float SpectOutOfLimitsPers;
	BOOL UseSigmaClippingInCheck; 
	enShkLimitType ShkLimitType;

	BOOL useMultyShkUnExFullLimits;
	
	stDetailedMassDesc DetailedMass;
	BOOL LimitRandomLinesOutsideTheProfile;
	
	float						  LinesOutsideTheBorder;
	
	BOOL						  UseTableLimits;
	
	enWhatToLiminInRndSpectrum    WhatToLimitInSpectrum;
	float AbDDBSpectrumPlus;
	float AbDDBSpectrumMinus;
	float TolDDBSpectrumPlus;
	float TolDDBSpectrumMinus;
	enLimitAndLevelUnitType SpectrumLimitUnitType;
	BOOL DisableLowLimitWhileOnNotching;
	SAFEARRAY(stShkLimitPair) LimitsTable
	SAFEARRAY(stChUnexceedLimit) UnexceedChParameters;

	BOOL CheckChannelsOnOverload;
}stLimitsSettings;


typedef [uuid(311D09EA-7943-4A18-ADAB-CFE991E4A3D1),
	struct stSyntheseSRSPoint
{
	float Freq;
	float Responce;
	float NegativeMax;
	float PositiveMax;
} stSyntheseSRSPoint;
cpp_quote("struct __declspec(uuid(\"{311D09EA-7943-4A18-ADAB-CFE991E4A3D1}\")) stSyntheseSRSPoint;")

	typedef [uuid(6A8B679F-E7C6-45F6-A0DB-378D2E4CD0ED),
	struct stSRSPointsFromSynthese
{
	int PointsCount;
	SAFEARRAY(stSyntheseSRSPoint) SRSPoints;
}stSRSPointsFromSynthese;

typedef [uuid(747684a8-7b15-4215-8484-7e674fce3e16),
	struct stSRSProfilesDescription
{
	int ID;
	BSTR Name;
	float EndAcc;
	float EndVel;
	float EndDisp;
	float MaxAcc;
	float MaxVel;
	float MaxDisp;
	float PWA;
	DWORD  CompencateSeed;
	stSRSSyntheseSettings SyntheseSettings;
	stSRSTable SRSTable;
	stWaveletsTable Wavelets;
	stSRSPointsFromSynthese SynthesePoints;
	DWORD RealShkLenInSamples;
	float RealSampleRate;
}stSRSProfilesDescription;
cpp_quote("struct __declspec(uuid(\"{747684a8-7b15-4215-8484-7e674fce3e16}\")) stSRSProfilesDescription;")


	typedef [uuid(d4b7ee82-d6ca-4131-9ab2-1c0ca9093935),
	struct stMosaSRSProfiles
{
	int ProfilesCount;
	float MaxAcc;
	float MaxVel;
	float MaxDisp;
	float EndAcc;
	float EndVel;
	float EndDisp;
	float ShkTimeInSec;
	double Te;
	double TeConc;
	SAFEARRAY(stSRSProfilesDescription) Profiles;
}stMosaSRSProfiles;

typedef [uuid(ee6226d6-3ac9-47b4-aab3-3e1d612b8c69),
	struct stMosaSRSTestSettingsStruct
{
	BOOL IsReportSettingsInited;
	BOOL TestStartQuestState;
	DWORD TestTimeInSec;
	DWORD TotalShkCount;
	int ActiveOutputsCount;
	int AxisesCount;
	SAFEARRAY(stMultishakerOutputLimitsDescription) OutputLimits;
	stMosaSRSProfiles TestProfiles;
	stMultishTaskToAxisMap Axises;
	stMultishakerReportSettings ReportSettings;
	stAnalyseSettings AnalysesSettings;
	stChannelsConfigSettings ChannelsConfig;
	stControlSettings ControlSettings;
	stLimitsSettings Limits;
	stSchedule Schedule;
	stDataSaveSettings DataSaveSettings;
}stMosaSRSTestSettingsStruct;
Sometimes getting data woks well, however sometimes an error appears with log which looks like:

Code: Select all

06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:ole:IRecordInfoImpl_RecordClear Not supported vt = 29
06e8:fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime"): stub
06e8:fixme:advapi:ReportEventW (00000000CAFE4242,0x0001,0x0000,0x00000402,0000000000000000,0x0001,0x00000000,00007FFFFE27A7F0,0000000000000000): stub
06e8:err:eventlog:ReportEventW L"Application: VisProbe_SL.exe\n"
06e8:err:eventlog:ReportEventW L"CoreCLR Version: 8.0.1425.11118\n"
06e8:err:eventlog:ReportEventW L".NET Version: 8.0.14\n"
06e8:err:eventlog:ReportEventW L"Description: The process was terminated due to an unhandled exception.\n"
06e8:err:eventlog:ReportEventW L"Exception Info: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.\n"
06e8:err:eventlog:ReportEventW L"Stack:\n"
06e8:err:eventlog:ReportEventW L"   at System.StubHelpers.MngdSafeArrayMarshaler.ClearNative(IntPtr, System.Object ByRef, IntPtr)\n"
All the arrays are initialized with SafeArrayCreateEx and deleted with SafeArrayDestroy functions, BSTRs are allocated with SysAllocString and deleted with SysFreeString.

Could you give me an advice of how to locate the reason of error and eliminate it?
Post Reply