BSOD 0x8E STATUS_SINGLE_STEP - c#

I have a BSOD 0x8E every day on five devices in same times on Windows 7.
Allways exception code - 04 - STATUS_SINGLE_STEP
as example:
1: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
KERNEL_MODE_EXCEPTION_NOT_HANDLED_M (1000008e)
This is a very common bugcheck. Usually the exception address pinpoints
the driver/function that caused the problem. Always note this address
as well as the link date of the driver/image that contains this address.
Some common problems are exception code 0x80000003. This means a hard
coded breakpoint or assertion was hit, but this system was booted
/NODEBUG. This is not supposed to happen as developers should never have
hardcoded breakpoints in retail code, but ...
If this happens, make sure a debugger gets connected, and the
system is booted /DEBUG. This will let us see why this breakpoint is
happening.
Arguments:
Arg1: 80000004, The exception code that was not handled
Arg2: ffdff2a5, The address that the exception occurred at
Arg3: a9c34d48, Trap Frame
Arg4: 00000000
Debugging Details:
------------------
DUMP_CLASS: 1
DUMP_QUALIFIER: 400
BUILD_VERSION_STRING: 7601.17514.x86fre.win7sp1_rtm.101119-1850
SYSTEM_MANUFACTURER: System manufacturer
SYSTEM_PRODUCT_NAME: System Product Name
SYSTEM_SKU: SKU
SYSTEM_VERSION: System Version
BIOS_VENDOR: American Megatrends Inc.
BIOS_VERSION: 1002
BIOS_DATE: 06/04/2013
BASEBOARD_MANUFACTURER: ASUSTeK COMPUTER INC.
BASEBOARD_PRODUCT: P8H61-I LX R2.0
BASEBOARD_VERSION: Rev X.0x
DUMP_TYPE: 2
BUGCHECK_P1: ffffffff80000004
BUGCHECK_P2: ffffffffffdff2a5
BUGCHECK_P3: ffffffffa9c34d48
BUGCHECK_P4: 0
EXCEPTION_CODE: (HRESULT) 0x80000004 (2147483652) - <Unable to get error code text>
FAULTING_IP:
+0
ffdff2a5 0000 add byte ptr [eax],al
TRAP_FRAME: a9c34d48 -- (.trap 0xffffffffa9c34d48)
ErrCode = 00000000
eax=00000000 ebx=846410c0 ecx=00000000 edx=00000000 esi=0c4cdb04 edi=00000000
eip=ffdff2a5 esp=a9c34dbc ebp=801ef000 iopl=0 ov dn di ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00004c86
ffdff2a5 0000 add byte ptr [eax],al ds:0023:00000000=??
Resetting default scope
CPU_COUNT: 2
CPU_MHZ: a8c
CPU_VENDOR: GenuineIntel
CPU_FAMILY: 6
CPU_MODEL: 3a
CPU_STEPPING: 9
CPU_MICROCODE: 6,3a,9,0 (F,M,S,R) SIG: 17'00000000 (cache) 17'00000000 (init)
CUSTOMER_CRASH_COUNT: 1
DEFAULT_BUCKET_ID: BAD_STACK_0x8E
BUGCHECK_STR: 0x8E
PROCESS_NAME: avp.exe
CURRENT_IRQL: 0
ANALYSIS_SESSION_HOST: NETMANNOTE
ANALYSIS_SESSION_TIME: 11-17-2017 12:11:18.0584
ANALYSIS_VERSION: 10.0.15063.468 x86fre
LAST_CONTROL_TRANSFER: from 00000000 to ffdff2a5
STACK_TEXT:
a9c34db8 00000000 0000027f 00000000 00000000 0xffdff2a5
STACK_COMMAND: .trap 0xffffffffa9c34d48 ; kb
SYMBOL_NAME: ANALYSIS_INCONCLUSIVE
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: Unknown_Module
IMAGE_NAME: Unknown_Image
DEBUG_FLR_IMAGE_TIMESTAMP: 0
BUCKET_ID: BAD_STACK_0x8E
PRIMARY_PROBLEM_CLASS: BAD_STACK
FAILURE_BUCKET_ID: BAD_STACK_0x8E
TARGET_TIME: 2017-11-16T13:53:07.000Z
OSBUILD: 7601
OSSERVICEPACK: 1000
SERVICEPACK_NUMBER: 0
OS_REVISION: 0
SUITE_MASK: 336
PRODUCT_TYPE: 1
OSPLATFORM_TYPE: x86
OSNAME: Windows 7
OSEDITION: Windows 7 WinNt (Service Pack 1) TerminalServer EmbeddedNT SingleUserTS
OS_LOCALE:
USER_LCID: 0
OSBUILD_TIMESTAMP: 2010-11-20 11:42:49
BUILDDATESTAMP_STR: 101119-1850
BUILDLAB_STR: win7sp1_rtm
BUILDOSVER_STR: 6.1.7601.17514.x86fre.win7sp1_rtm.101119-1850
ANALYSIS_SESSION_ELAPSED_TIME: cc3
ANALYSIS_SOURCE: KM
FAILURE_ID_HASH_STRING: km:bad_stack_0x8e
FAILURE_ID_HASH: {993602b9-6aa7-fbab-86a8-bb6ad81a3997}
Followup: MachineOwner
The service name can be different: av.exe, scvhost.ext,..
I know that is due to the a driver does not process STATUS_SINGLE_STEP exception.
Is any idea how to find wrong driver? There is no stack and module name in the dump...
I tried to run the Mirosoft Driver Verifier with standart flags and all drivers without Microsoft drivers, dump listing is above.

Related

Unable to verify checksum for avformat-58.dll

The following is a crash dump produced by my video streaming application written in .NET Core 3.1 with Windows Forms 32-bit. I'm trying to workout how to best interpret this information. I cannot find this dll being referenced anywhere.
Crash dump:
PROCESS_NAME: Name.exe
EXCEPTION_CODE_STR: 80004005
FAULTING_THREAD: ffffffff
STACK_TEXT:
4700eaa4 04a18620 System_Private_CoreLib!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw+0x18
4700eaac 0ee6083c System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal+0xbc
4700eae0 666c328f System_Private_CoreLib!System.Threading.ThreadHelper.ThreadStart+0x22db9d17
STACK_COMMAND: ** Pseudo Context ** ManagedPseudo ** Value: ffffffff ** ; kb
SYMBOL_NAME: System_Private_CoreLib!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw+18
MODULE_NAME: System_Private_CoreLib
IMAGE_NAME: System.Private.CoreLib.dll
FAILURE_BUCKET_ID: CLR_EXCEPTION_80004005_System.Private.CoreLib.dll!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw
OS_VERSION: 10.0.19041.1
BUILDLAB_STR: vb_release
OSPLATFORM_TYPE: x86
OSNAME: Windows 10
IMAGE_VERSION: 4.700.22.16002
FAILURE_ID_HASH: {a19b02e2-e5ea-3965-96bf-e2de5607741e}
Followup: MachineOwner
Added additional information from WinDbg:
eax=6b82f220 ebx=00000005 ecx=00000005 edx=00000000 esi=e0434352 edi=6b82f2dc
eip=764fb982 esp=6b82f220 ebp=6b82f278 iopl=0 nv up ei pl nz ac po nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000212
KERNELBASE!RaiseException+0x62:
764fb982 8b4c2454 mov ecx,dword ptr [esp+54h] ss:002b:6b82f274=2213319e
Exception object: 8eff28b0
Exception type: System.InvalidOperationException
Message: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
InnerException: <none>
StackTrace (generated):
SP IP Function
6B82EE88 182A2633 System_Windows_Forms!System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)+0x2db
6B82EF0C 182A2242 System_Windows_Forms!System.Windows.Forms.Control.BeginInvoke(System.Delegate, System.Object[])+0x4a
6B82EF3C 050627FA System_Windows_Forms!System.Windows.Forms.WindowsFormsSynchronizationContext.Post(System.Threading.SendOrPostCallback, System.Object)+0x3a
6B82EF50 1C19CB69 System_Private_CoreLib!System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.PostAction(System.Object)+0x71
6B82EF68 166EACFD System_Private_CoreLib!System.Threading.Tasks.AwaitTaskContinuation.RunCallback(System.Threading.ContextCallback, System.Object, System.Threading.Tasks.Task ByRef)+0x3d
6B82F3CC 05232A40 System_Private_CoreLib!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()+0x18
6B82F3D4 6AD5BCD7 System_Private_CoreLib!System.Threading.Tasks.Task+<>c.<ThrowAsync>b__139_1(System.Object)+0x17
6B82F3D8 0543AAD9 System_Private_CoreLib!System.Threading.QueueUserWorkItemCallback+<>c.<.cctor>b__6_0(System.Threading.QueueUserWorkItemCallback)+0x11
6B82F3DC 0543AAAE System_Private_CoreLib!System.Threading.ExecutionContext.RunForThreadPoolUnsafe[[System.__Canon, System.Private.CoreLib]](System.Threading.ExecutionContext, System.Action`1<System.__Canon>, System.__Canon ByRef)+0x46
6B82F3F4 0543AA4F System_Private_CoreLib!System.Threading.QueueUserWorkItemCallback.Execute()+0x2f
6B82F400 24B2DE3B System_Private_CoreLib!System.Threading.ThreadPoolWorkQueue.Dispatch()+0x1db
6B82F44C 24B2DC45 System_Private_CoreLib!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()+0x5
StackTraceString: <none>
HResult: 80131509

Xamarin.iOS app crashes on startup with iPhone5 when downloaded from app store. DYLD, Library not loaded error.-+

I am working on a Xamarin application. The app works fine when deployed Ad-Hoc on my iPhone5. The App works fine on iPad and iPhone6 both in Ad-Hoc and App Store versions. However, I get an instant crash when I try to start the App Store/TestFlight version on my iPhone 5.
Here is the crash log :
{"bug_type":"109","os_version":"iPhone OS 10.3.4 (14G61)","build_version":"1.3.1","timestamp":"2019-11-25 14:01:05.33 -0500","app_name":"CPEEP.iOS","bundleID":"com.altilogix.cpeeps","incident_id":"CE93C272-D023-4058-AE75-6BF205893BEB","name":"CPEEP.iOS","is_first_party":false,"app_version":"1.3.1","share_with_app_devs":true,"slice_uuid":"8d939558-dc29-3773-ba5d-be06524a29ef","adam_id":1455126201}
Incident Identifier: CE93C272-D023-4058-AE75-6BF205893BEB
CrashReporter Key: 686e40dceea53078e133cbcd92ef064c6b7840a0
Hardware Model: iPhone5,1
Process: CPEEP.iOS [330]
Path: /private/var/containers/Bundle/Application/23B56006-7F53-468B-AAC2-18B74EA02613/CPEEP.iOS.app/CPEEP.iOS
Identifier: com.altilogix.cpeeps
Version: 1.3.1 (1.3.1)
Code Type: ARM (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.altilogix.cpeeps [527]
Date/Time: 2019-11-25 14:01:05.2600 -0500
Launch Time: 2019-11-25 14:01:05.0000 -0500
OS Version: iPhone OS 10.3.4 (14G61)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Description: DYLD, Library not loaded: #rpath/MaterialComponents.framework/MaterialComponents | Referenced from: /var/containers/Bundle/Application/23B56006-7F53-468B-AAC2-18B74EA02613/CPEEP.iOS.app/CPEEP.iOS | Reason: image not found
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 Crashed:
0 dyld 0x03f1c1dc 0x3efa000 + 139740
1 dyld 0x03f1be3e 0x3efa000 + 138814
2 dyld 0x03f1be78 0x3efa000 + 138872
3 dyld 0x03efdca4 0x3efa000 + 15524
4 dyld 0x03f00588 0x3efa000 + 25992
5 dyld 0x03efb1d0 0x3efa000 + 4560
6 dyld 0x03efb040 0x3efa000 + 4160
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x04064228
r4: 0x000000ab r5: 0x04063e28 r6: 0x00000000 r7: 0x04063df4
r8: 0x00000000 r9: 0x000000ab r10: 0x00000000 r11: 0x00000000
ip: 0x00000209 sp: 0x04063db4 lr: 0x03f1be3f pc: 0x03f1c1dc
cpsr: 0x40000010
Binary Images:
0x98000 - 0x3af3fff CPEEP.iOS armv7 <8d939558dc293773ba5dbe06524a29ef> /var/containers/Bundle/Application/23B56006-7F53-468B-AAC2-18B74EA02613/CPEEP.iOS.app/CPEEP.iOS
0x3efa000 - 0x3f25fff dyld armv7s <f0f6706c72713272afd9a5f6ec9b6071> /usr/lib/dyld
0x4066000 - 0x4439fff libSkiaSharp armv7 <3d824f59dc7b393c906a666eaa541d0e> /var/containers/Bundle/Application/23B56006-7F53-468B-AAC2-18B74EA02613/CPEEP.iOS.app/Frameworks/libSkiaSharp.framework/libSkiaSharp
EOF
Here is my build config:
I build for ARMv7 + ARM64, with my configuration set to AppStore
I've looked around but most solutions to problems of this nature seem to deal with Swift or XCode and not Xamarin/Visual Studio.
I have tried this solution : https://www.gitmemory.com/issue/xamarin/XamarinComponents/597/520597929 with no success.
I am a beginner when it comes to Xamarin and deploying apps.
Edit:
So it turns out the Frameworks in my .ipa have a info.plist files with a UIRequiredDeviceCapabilities key with the value arm64 which makes Apple's thinning process remove armv7 versions of these frameworks. I have no clue why this key appears in those frameworks however.
Affected frameworks :
MaterialComponents.framework
MDFInternationalization.framework
MDFTextAccessibility.framework
MotionAnimator.framework
MotionInterchange.framework
MotionTransitioning.framework
Unaffected frameworks :
libSkiaSharp.framework

How can we get Disk Performance info in C#

I want to get the following information about the disk performance.
I used MSStorageDriver_FailurePredictThresholds, MSStorageDriver_ATAPISmartData, MSStorageDriver_FailurePredictStatus class to get relative information but not getting the right result.
This isn't everything you wanted, but the Win32_PerfFormattedData_PerfDisk_PhysicalDisk WMI class gives you current read / write / transfer rate and activity time. It also gives some averages but I'm not sure how they are calculated (it seems odd that AvgDiskBytesPerWrite is 0)
// NOTE: Use ManagementObjectSearcher to find the path your interested in
var path = "Win32_PerfFormattedData_PerfDisk_PhysicalDisk.Name='0 C:'";
var wmiObj = new ManagementObject(path);
wmiObj.Properties.Cast<PropertyData>().ToDictionary(p => p.Name, p => p.Value).Dump();
/* OUTPUT */
AvgDiskBytesPerRead 63167
AvgDiskBytesPerTransfer 63167
AvgDiskBytesPerWrite 0
AvgDiskQueueLength 0
AvgDiskReadQueueLength 0
AvgDisksecPerRead 0
AvgDisksecPerTransfer 0
AvgDisksecPerWrite 0
AvgDiskWriteQueueLength 0
Caption null
CurrentDiskQueueLength 0
Description null
DiskBytesPersec 20991616
DiskReadBytesPersec 20991616
DiskReadsPersec 332
DiskTransfersPersec 332
DiskWriteBytesPersec 0
DiskWritesPersec 0
Frequency_Object null
Frequency_PerfTime null
Frequency_Sys100NS null
Name 0 C:
PercentDiskReadTime 80
PercentDiskTime 80
PercentDiskWriteTime 0
PercentIdleTime 32
SplitIOPerSec 0
Timestamp_Object null
Timestamp_PerfTime null
Timestamp_Sys100NS null
if you looking for this, check this Link. An example of output is:
###############################################################
Current Directory Path: D:\WinDDK\32bit\drivespeed
Total MB 230000, Free MB 103752, Used MB 126248
Windows Storage Speed Test 32-Bit Version 1.2, Thu Mar 01 22:31:08 2012
Copyright (C) Roy Longbottom 2011
8 MB File 1 2 3 4 5
Writing MB/sec 56.68 105.37 61.95 72.48 75.33
Reading MB/sec 80.65 108.15 81.10 81.42 82.25
16 MB File 1 2 3 4 5
Writing MB/sec 81.53 94.61 81.41 88.06 71.39
Reading MB/sec 88.25 72.75 93.53 93.51 92.70
32 MB File 1 2 3 4 5
Writing MB/sec 90.35 83.60 72.52 80.24 72.71
Reading MB/sec 87.00 87.67 78.39 80.24 78.62
---------------------------------------------------------------------
8 MB Cached File 1 2 3 4 5
Writing MB/sec 703.27 628.08 1050.99 1617.29 1609.70
Reading MB/sec 1930.60 2045.13 2054.49 2135.91 2390.08
---------------------------------------------------------------------
Bus Speed Block KB 64 128 256 512 1024
Reading MB/sec 174.36 189.07 221.83 247.82 261.21
---------------------------------------------------------------------
1 KB Blocks File MB > 2 4 8 16 32 64 128
Random Read msecs 0.14 0.14 0.15 0.17 3.24 6.96 8.90
Random Write msecs 0.53 0.66 1.03 1.38 1.74 1.83 2.42
---------------------------------------------------------------------
500 Files Write Read Delete
File KB MB/sec ms/File MB/sec ms/File Seconds
2 0.32 6.44 0.95 2.17 0.123
4 6.49 0.63 12.21 0.34 0.113
8 11.54 0.71 15.17 0.54 0.121
16 22.04 0.74 41.78 0.39 0.116
32 32.92 1.00 26.31 1.25 0.074
64 68.72 0.95 51.88 1.26 0.132
End of test Thu Mar 01 22:32:11 2012

PInvoke signature does not match the unmanaged target signature

I'm trying to create a wrapper C# file for modbusm.dll (win-tech.com/html/mbusocx.htm) ,I'm using dumpbin output for this.
Dump of file modbusm.dll
File Type: DLL
Section contains the following exports for modbusm.dll
00000000 characteristics
41128817 time date stamp Fri Aug 06 00:48:47 2004
0.00 version
1 ordinal base
27 number of functions
27 number of names
ordinal hint RVA name
1 0 000085BA _AbortTheCall#4
2 1 00003441 _CloseConnection#4
3 2 000033A7 _ConnectASCII#12
4 3 000033E1 _ConnectDanielsASCII#12
5 4 000033C4 _ConnectDanielsRTU#12
6 5 0000338A _ConnectRTU#12
7 6 00001019 _ConnectTCP2#12
8 7 00001000 _ConnectTCP#8
9 8 0000829A _DialCall#8
10 9 00003376 _EnableConnectionCallback#4
11 A 00003342 _EnableModbusCallback#8
12 B 00008123 _GetCallState#8
13 C 00007FD2 _GetLineDeviceName#12
14 D 00003320 _GetPollDelay#0
15 E 00003339 _Get_Modbus_DLL_Revision#0
16 F 000033FE _HookRspNotification#16
17 10 000032ED _InitializeWinSock#0
18 11 0000277C _MBAPWndProc#16
19 12 0000393F _MODBUSResponse#16
20 13 00007EAA _NumberOfLineDevices#0
21 14 00003521 _PollMODBUS#8
22 15 000039F2 _ReadDebugData#16
23 16 00003BA4 _ReadTransparentResponse#16
24 17 0000332A _SetPollDelay#4
25 18 00003313 _UnInitializeWinSock#0
26 19 00003712 _WriteMODBUS#12
27 1A 00003AB3 _WriteTransparentString#12
Summary
5000 .data
2000 .rdata
2000 .reloc
1000 .rsrc
C000 .text
my C# wrapper is
class MbMasterV7
{
[DllImport("modbusm.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "_ConnectTCP2#12")]
public static extern int ConnectModbusTCP(short Port);
public static string TCPDevice { set; get; }
}
when I am running the code
MbMasterV7.TCPDevice = "127.0.0.1"; // from demo version of .ocx file converted using tlbimp.exe
MbMasterV7.ConnectModbusTCP(502);
in visual studio, I am getting exception
A call to PInvoke function
'TestApp!TestApp.MbMasterV7::ConnectModbusTCP' has unbalanced the
stack. This is likely because the managed PInvoke signature does not
match the unmanaged target signature. Check that the calling
convention and parameters of the PInvoke signature match the target
unmanaged signature.
I have tried all calling conventions and getting same error.
The .Net libraries are available for modbus protocol are not good enough for the new plc type I am working with.
FILE HEADER VALUES
14C machine (x86)
5 number of sections
41128817 time date stamp Fri Aug 06 00:48:47 2004
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
210E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
DLL
OPTIONAL HEADER VALUES
10B magic # (PE32)
6.00 linker version
C000 size of code
A000 size of initialized data
0 size of uninitialized data
94E4 entry point (100094E4)
1000 base of code
D000 base of data
10000000 image base (10000000 to 10016FFF)
1000 section alignment
1000 file alignment
4.00 operating system version
0.00 image version
4.00 subsystem version
0 Win32 version
17000 size of image
1000 size of headers
0 checksum
2 subsystem (Windows GUI)
0 DLL characteristics
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
DF90 [ 357] RVA [size] of Export Directory
D7C8 [ 50] RVA [size] of Import Directory
14000 [ 3E8] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
15000 [ BC0] RVA [size] of Base Relocation Directory
0 [ 0] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
0 [ 0] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
D000 [ 198] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory
First thing first, _ConnectTCP2#12 means that 12 bytes are passed as parameters to the function, which means that short (which is 2 bytes long) is obviously incompatible. You need to pass 12 bytes as parameters, presumably as 3 DWORDs.
Let us, for the sake of adventure, actually disassemble the binary to see what's going on there.
So: ConnectTCP#8 is receiving 2 DWORDs as arguments and calling ConnectTCP2 with 0x1F6 as the second parameter (which is actually a short). Also, the calling convention is stdcall.
That's enough information for us to figure out how to call the function:
[DllImport("modbusm.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_ConnectTCP2#12")]
public static extern int ConnectModbusTCP(int a, short Port, int b);
Will work, but will throw
"Unhandled Exception: System.AccessViolationException:
Attempted to read or write protected memory.
This is often an indication that other memory is corrupt."
This is because the second integer (that I called b) is actually a pointer to a structure (which its values I can only guess according to the code). So let us reconstruct the structure. According to the code, the structure is accessed five times as following:
Offset Type
0x00 -> INT32
0x04 -> INT32
0x08 -> INT32
0x0C -> INT16
0x10 -> INT32
So, by creating the following structure:
struct MbMasterStruct
{
int a;
int b;
int c;
short d;
int e;
}
And redefining the function to be:
unsafe class MbMasterV7
{
[DllImport("modbusm.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_ConnectTCP2#12")]
public static extern int ConnectModbusTCP(int a, short Port, MbMasterStruct * b);
}
And calling it as following:
static void Main(string[] args)
{
var structure = new MbMasterStruct();
unsafe
{
MbMasterV7.ConnectModbusTCP(1, 2, &structure);
}
}
It actually works, and it doesn't throw. On my computer, it returned 51 (when the structure and parameters were all zero).
It is now up to you to understand each parameters and see how to properly call the function.

FFMPEG - Scrambled Output converting from VOB with ffmpeg

I've concatenated a series of VOB files from a DVD into a single VOB file and I am trying to convert it to MP4 or other similar format. I see a lot of errors when converting and the output appears scrambled.
>ffmpeg.exe" -i file.vob -sameq file.mp4
FFmpeg version git-N-29181-ga304071, Copyright (c) 2000-2011 the FFmpeg develope
rs
built on Apr 18 2011 21:24:03 with gcc 4.5.2
configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --ena
ble-memalign-hack --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --cross-prefix=i686-w6
4-mingw32- --target-os=mingw32 --arch=x86_32 --extra-cflags=-I/home/kyle/softwar
e/ffmpeg/external-libraries/win32/include --extra-ldflags=-L/home/kyle/software/
ffmpeg/external-libraries/win32/lib --pkg-config=pkg-config
libavutil 50. 40. 1 / 50. 40. 1
libavcodec 52.120. 0 / 52.120. 0
libavformat 52.108. 0 / 52.108. 0
libavdevice 52. 4. 0 / 52. 4. 0
libavfilter 1. 79. 0 / 1. 79. 0
libswscale 0. 13. 0 / 0. 13. 0
[mpeg2video # 01751A90] ac-tex damaged at 5 16
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 1
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 2
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 3
[mpeg2video # 01751A90] invalid mb type in I Frame at 0 4
[...]
I'm guessing this is CSS scrambling and I need to do some sort of DeCSS. Does FFMpeg have an option for this? Cringe if you'd like, but is there C# source to achieve this?
My end goal is really just to get some DVDs that I own onto my media server. I've tried a few demo-ware products with limited success including Acala DVD Ripper, Click to Disk, AVIDemux to name a few. I even paid for a couple of them to get the full version, but Acala only works for about half of my DVDs and Click to Disk can decode the VOB, but I need to use FFMpeg to convert. I'd like to have it all in one app that works and I am willing to write some code for it.

Categories

Resources