News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Interprocess communication

Started by Mikl__, August 18, 2022, 11:29:24 AM

Previous topic - Next topic

Mikl__

#30
09. Mutex. Transfer pictures
I created icons of the size 16x16, 32x32, 64x64, 128x128, 256x256 pixels for the experiment





The transmission is in nibbles+delays for synchronization. The transfer of the 256x256 icon took approximately 42 minutes (2513036/60000=41.88393(3)). It can be seen it is necessary to change the algorithm and increase the transmission speed.

||Size of Resource (bytes)|mSeconds|Bytes/mSec
|text string|37|702|0.05270655
|icon 16х16|1128|20639|0.05465381
|icon 32х32|4264|81776|0.05214244
|icon 64х64|16936|323546|0.05234495
|icon 128х128|67624|543882|0.12433579
|icon 256х256|270376|2513036|0.10758939

jj2007

That is incredibly slow, Mikl :sad:

For comparison, see my attached server/client pair; it uses WM_COPYDATA to transfer Windows.inc (977412 bytes) in less than a second.

Mikl__

Ciao, jj2007! Grazie per l'esempio...
QuoteThat is incredibly slow
I know about it . I already answered your question
QuoteNext step would be to test which is the fastest
I can answer which of the ways are the slowest, these are Interprocess Synchronization: Event Pipes, Mutexes and Semaphores. I even had to maden a progress bar to prevent the user from exiting the program before the data was transferred. The rest of the methods are quite faster (several MBytes are transferred in several mSec). They are: WinSockets, Dynamic Data Exchange, Named Pipes, MailSlots, Memory Mapped File, Paging File, ClipBoard and WM_COPYDATA

Mikl__

#33
[deleted by me]

jj2007

My dear friend Mikl,

If I had a 48 hours day, I might be able to help you - but 24 hours are not even enough for my own babies... sorry :thup:

We all adore what you are doing, but don't expect too much from us lazybones :cool:

Biterider

#35
Hi Mikl_
I'm not sure if I understood this correctly, but as a text file you could use the well-known bible.txt. You could use any graphics file (.bmp, .png, etc.) as a binary file and reconstruct it on the receiving end and display it again (like you did before).

Biterider

six_L

Hi,Mikl_
you'v done the great work.
QuoteHi All!
Help me too... I would like to finish the tutorial. I still need bin-files and source files for interprocessor communication via:

    OLE/ActiveX/COM
    Distributed Component Object Model (DCOM)
    Remote Method Invocation (RMI)
    Common Object Request Broker Architecture (CORBA)
    Remote Procedure Call (RPC)
    Local Procedure Call (LPC)
    Microsoft Message Queue (MSMQ)

An example is enough for me to transfer a small text string from application to application. Pleeez!
Your codes about IPC is the first I'v seen. i can only learn.
Say you, Say me, Say the codes together for ever.

Mikl__

#37
Remote Procedure Call (RPC)

Transferring text, pictures and music between apps is almost instantaneous!
Server application text 14r.asm
; GUI #
include win64a.inc
IDC_DIALOG    equ 200
IDC_TXT          equ 100
ID_ICON          equ 102
IDC_ICON1      equ 500
RPC_S_OK       equ 0
RPC_C_LISTEN_MAX_CALLS_DEFAULT equ 1234
RPC_VERSION  struc
    MajorVersion dw ?
    MinorLinker  dw ?
RPC_VERSION  ends
RPC_SERVER_INTERFACE struct
    Len        dd ?
    InterfaceId          GUID <>
    a           RPC_VERSION <>
    TransferSyntax    GUID <>
    b           RPC_VERSION <>
            dd ?
    DispatchTable                   dq ?
    RpcProtseqEndpointCount  dd ?,?
    RpcProtseqEndpoint          dq ?
    DefaultManagerEpv           dq ?
    InterpreterInfo                 dq ?
    Flags                               dd ?,?
RPC_SERVER_INTERFACE ends

.code
WinMain proc
        enter    30h,0
        mov    r9d,offset DialogProc
        and    qword ptr[rbp-10h],0
        invoke  DialogBoxParamA,IMAGE_BASE,IDC_DIALOG,HWND_DESKTOP
        invoke  RtlExitUserProcess,NULL
WinMain endp
DialogProc proc hWnddlg:qword,msg:qword,wParam:qword,lParam:qword
       mov    hWnddlg,rcx
       mov    lParam,r9

        cmp    edx,WM_INITDIALOG
        je     wmINITDIALOG
        cmp    edx,WM_CLOSE
        je    wmCLOSE
        cmp    edx,WM_COMMAND
        je    wmCOMMAND
        cmp    edx,WM_DESTROY
        je    wmDESTROY
       xor    eax,eax
        jmp    exit0
wmDESTROY:
    jmp    wmBYE
wmINITDIALOG:mov hWnd,rcx
       invoke    GetProcessHeap
       mov     hHeap,rax
; Найти окно отправителя
        mov    edx,offset szWin
        invoke  FindWindowA,NULL
        or      eax,eax
        jnz    wmBYE
       mov    edx,offset Error1
       mov    r8d,offset szAppName
    invoke    MessageBoxA,hWnddlg,,,MB_ICONEXCLAMATION or MB_YESNO
    cmp    eax,IDNO
    jz      wmBYE
    mov    ecx,offset szService
    invoke    WinExec,,SW_SHOW
;start Rpc Server And Listen---------------------------------
    mov    r8d,offset endpoint
    mov    ecx,offset protocol
    invoke    RpcServerUseProtseqEpA,,RPC_C_LISTEN_MAX_CALLS_DEFAULT,,0
    or    eax,eax;cmp    eax,RPC_S_OK
    jz    @f
    mov    edx,offset Format
    jmp    @0
@@:    mov    ecx,offset RPC_SampleInterface_v1_0_s_ifspec
    invoke    RpcServerRegisterIf,,0,0
    or    eax,eax;cmp    eax,RPC_S_OK
    jz    @f
    mov    edx,offset aUnableToRegist
    jmp    @0
; Start to listen for remote procedure
; calls for all registered interfaces.
; This call will not return until
; RpcMgmtStopServerListening is called.
@@:    invoke    RpcServerListen,1,\;Recommended minimum number of threads.
    RPC_C_LISTEN_MAX_CALLS_DEFAULT,\;Recommended maximum number of threads
    TRUE
    or    eax,eax;cmp    eax,RPC_S_OK
    jz    wmBYE
    mov    edx,offset aUnableToStartL
    mov    r8d,offset szAppName
    invoke    MessageBoxA,hWnddlg,,,MB_ICONEXCLAMATION or MB_OK
    mov    ecx,offset RPC_SampleInterface_v1_0_s_ifspec
    invoke    RpcServerUnregisterIf,,0,0
    or    eax,eax;cmp    eax,RPC_S_OK
    jz    wmBYE
    mov    edx,offset aUnableToUnregi
@0:    mov    r8d,offset szAppName
    invoke    MessageBoxA,hWnddlg,,,MB_ICONEXCLAMATION or MB_OK
    jmp    wmBYE
;--------------------------------------------------
wmCOMMAND:cmp    r8d,BN_CLICKED shl 16 + IDCANCEL
    jne    wmBYE
wmCLOSE:invoke    EndDialog,,0
wmBYE:    mov    eax,TRUE
exit0:    leave
    retn
DialogProc endp

j_NdrServerCall2 proc
    jmp    NdrServerCall2
j_NdrServerCall2 endp
; Memory allocation function for RPC.
; The runtime uses these two functions for allocating/deallocating
; enough memory to pass the string to the server.
MIDL_user_allocate proc len:qword
    mov    r8d,ecx
    invoke    RtlAllocateHeap,hHeap,0
    leave
    retn
MIDL_user_allocate endp
MIDL_user_free proc lpMem:qword
    mov    r8d,ecx
    invoke    HeapFree,hHeap,0
    leave
    retn
MIDL_user_free endp
RPC_SampleInterface_sampleFunc proc handle_t:qword,size_:dword,buffer:qword
local    hWaveOut:qword
local    lpwiocb:WAVEHDR

    mov    buffer,r8
    mov    size_,edx
    mov    handle_t,rcx
    cmp    byte ptr[r8],CF_TEXT
    jne    @f
    and    byte ptr[r8+rdx],0
    inc    r8
    invoke    SetDlgItemTextA,hWnd,IDC_TXT;,buffer
    jmp    @0
;------------------------------------------------------------------
@@:    cmp    byte ptr[r8],CF_BITMAP
    jne    @f
    lea    ecx,[r8+1]
    invoke  CreateIconFromResourceEx,,,TRUE,30000h,256,256,LR_DEFAULTCOLOR
    invoke  SendDlgItemMessageA,hWnd,ID_ICON,STM_SETIMAGE,IMAGE_ICON,eax
    jmp    @0
;------------------------------------------------------------------
@@:    mov    r8,buffer
;"RIFF"+(File size)+(File Type Header)+(Format chunk marker)+(Length of format data) = 14h
        add    r8d,14h
        invoke    waveOutOpen,&hWaveOut,WAVE_MAPPER,,0,0,WAVE_ALLOWSYNC
; Подготавливаем заголовок для вывода
    lea    edi,lpwiocb
    mov    edx,edi
    xor    eax,eax
    mov    ecx,(sizeof WAVEHDR)/8
    rep    stosq

    mov    rax,buffer
;"RIFF"+(File size)+(File Type Header)+(Format chunk marker)+(Length of format data)+\
;(Type of format)+(Number of Channels)+(Sample Rate)+(Sample Rate*BitsPerSample*Channels/8)+\
;(BitsPerSample*Channels/8)+(Bits per sample)+("data" chunk header)+(Size of the data section)=2Ch
    add    rax,2Ch
    mov    [rdx].WAVEHDR.lpData,rax ;адрес блока данных
    mov    eax,size_
    sub    eax,2Ch
    mov    [rdx].WAVEHDR.dwBufferLength,eax ;размер блока данных
    invoke    waveOutPrepareHeader,hWaveOut,,sizeof WAVEHDR
; Запускаем проигрывание блока
    invoke    waveOutWrite,hWaveOut,&lpwiocb,sizeof WAVEHDR
@@:    test    lpwiocb.dwFlags,WHDR_DONE
    jz    @b
    invoke    waveOutUnprepareHeader,hWaveOut,&lpwiocb,sizeof WAVEHDR
    invoke    waveOutClose,hWaveOut
@0:    leave
    retn
RPC_SampleInterface_sampleFunc endp
;-----------------------------------------------------------------------
.data
szWin        db "Remote Procedure Call Sender",0
Error1        db "The server is not running.",10,"Run?",0
szAppName    db "Remote Procedure Call Reciever",0
szService    db "14s",0
protocol    db "ncalrpc",0
endpoint    db "{46E785FC-BCCC-46B8-B161-D6C90D391670}",0; // Unique user-defined endpoint ID in a free form
Format        db "Unable to setup protocol sequence",0
aUnableToRegist    db "Unable to register the interface",0
aUnableToStartL db "Unable to start listening",0
aUnableToUnregi db "Unable to unregister the interface",0
hWnd        dq ?
hHeap        dq ?
;
RPC_SampleInterface_v1_0_s_ifspec label RPC_SERVER_INTERFACE
    dd sizeof RPC_SERVER_INTERFACE;Length
    GUID <8A4A7813h,0ADAAh,49BCh,{99h,6Ah,4Dh,47h,71h,5Fh,0CAh,40h}>
    RPC_VERSION <1,0>          ;RPC_VERSION  MajorVersion: u16, MinorVersion: u16 +14
    GUID <8A885D04h,1CEBh,11C9h,{9Fh,0E8h,8,0,2Bh,10h,48h,60h}>               ;+20
    RPC_VERSION <2,0>          ;RPC_VERSION  MajorVersion: u16, MinorVersion: u16 +28
    dd 0                                                 ;+2C
    dq RPC_SampleInterface_v1_0_DispatchTable;DispatchTable: *mut RPC_DISPATCH_TABLE +30
    dd 0,0 ;RpcProtseqEndpointCount: u32                 +38
    dq 0   ;RpcProtseqEndpoint: *mut RPC_PROTSEQ_ENDPOINT +3C
    dq 0   ;DefaultManagerEpv: *mut c_void               +44
    dq RPC_SampleInterface_ServerInfo;InterpreterInfo: *const c_void +4C
    dd 4000000h  ;Flags: u32
RPC_SampleInterface_v1_0_DispatchTable:
    dq 1
    dq RPC_SampleInterface_table
    dq 0
RPC_SampleInterface_table:
    dq j_NdrServerCall2
    dq 0
;---------------------------------------------
RPC_SampleInterface_ServerInfo:
        dq RPC_SampleInterface_StubDesc
        dq RPC_SampleInterface_ServerRoutineTable
        dq RPC_SampleInterface__MIDL_ProcFormatString
        dq RPC_SampleInterface_FormatStringOffsetTable
        dq 0
        dq 0
        dq 0
        dq 0
RPC_SampleInterface_StubDesc:
        dq RPC_SampleInterface_v1_0_s_ifspec
        dq MIDL_user_allocate   
        dq MIDL_user_free       
        dq 0                   
        dq 0                   
        dq 0                   
        dq 0                   
        dq 0                   
        dq RPC_SampleInterface__MIDL_TypeFormatString
        dd 1
        dd 50002h
        dq 0
        dd 8010274h
        dq 0
        dq 0
        dq 0
        dd 0
        dq 1
        dq 0
        dq 0
        dq 0
;------------------------------------------
RPC_SampleInterface_ServerRoutineTable dq RPC_SampleInterface_sampleFunc
RPC_SampleInterface__MIDL_ProcFormatString:
    db 0,48h
    dd 0
    dw 0
    dw 18h
    db 32h,0
    dw 0
    dw 8
    dw 0
    db 42h,2,0Ah,5
    dw 0
    dw 1
    dw 0
    dw 0
    dw 48h
    dw 8
    db 8,0
    dw 10Bh
    dw 10h
    dw 6
    db 0
RPC_SampleInterface_FormatStringOffsetTable:
    dd 0
RPC_SampleInterface__MIDL_TypeFormatString:
    dw 0
    db 11h,0
    dw 2
    db 1Bh,0
    dw 1
    db 29h,0
    dw 8
    dw 1
    db 2,5Bh,0
end
resources (14r.rc)#include "resource.h"
#define IDC_DIALOG    200
#define IDC_TXT        100
#define ID_ICON        102

IDC_DIALOG DIALOG 0,0,212,140
STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX |
WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK
CAPTION "Remote Procedure Call Reciever"
BEGIN
    CONTROL    "",-1,"BUTTON",BS_GROUPBOX, 2, -1, 207, 24
    CONTROL    "",IDC_TXT,"STATIC",WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL,5,7,199,13
    DEFPUSHBUTTON  "Exit",IDCANCEL,149,27,60,15
        CONTROL    1,ID_ICON,"STATIC",WS_CHILDWINDOW | SS_ICON,5,23,128,128
END
Application client text (14s.asm); GUI #
include win64a.inc
ID_TXT        equ 100
ID_SEND_TXT    equ 101
ID_SEND_ICO    equ 102
ID_SEND_WAV    equ 103
IDC_DIALOG    equ 200
IDC_ICON1    equ 500
IDC_IMG1     equ 104
RPC_S_OK    equ 0
RPC_C_LISTEN_MAX_CALLS_DEFAULT equ 1234

RPC_VERSION  struc
    MajorVersion dw ?
    MinorLinker  dw ?
RPC_VERSION  ends

RPC_CLIENT_INTERFACE struct
    Len        dd ?
    InterfaceId    GUID <>
    a        RPC_VERSION <>
    TransferSyntax    GUID <>
    b        RPC_VERSION <>
            dd ?
    DispatchTable    dq ?
    RpcProtseqEndpointCount  dd ?,?
    RpcProtseqEndpoint dq ?
    DefaultManagerEpv dq ?
    InterpreterInfo dq ?
    Flags        dd ?,?
RPC_CLIENT_INTERFACE ends
.code
WinMain proc
    enter    30h,0
    mov    r9d,256;cx
    mov    [rbp-10h],r9
    mov    qword ptr [rbp-8],LR_DEFAULTCOLOR
    invoke    LoadImageA,IMAGE_BASE,IDC_ICON1,IMAGE_ICON;,256,256,LR_DEFAULTCOLOR
    mov    r9d,offset DialogProc
    mov    qword ptr[rbp-10h],rax;30h-10h=+20h
    invoke    DialogBoxParamA,IMAGE_BASE,IDC_DIALOG,HWND_DESKTOP
    invoke    RtlExitUserProcess,NULL
WinMain endp

DialogProc proc hWnddlg:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD
local    hResource:qword
local    pResource:qword
local    FSize:qword
local    hFile:dword
local    szReadWrite:qword    ;number of bytes actually read or write
local    stringBinding:qword

    mov    hWnddlg,rcx
    mov    lParam,r9

    cmp    edx,WM_INITDIALOG
        je    wmINITDIALOG
    cmp    edx,WM_CLOSE
    je    wmCLOSE
    cmp    edx,WM_COMMAND
    je    wmCOMMAND
    cmp    edx,WM_DESTROY
    je    wmDESTROY
    xor    eax,eax
    jmp    exit0
wmDESTROY:
    jmp    wmBYE
wmSEND_WAV:mov    ecx,offset wav_file
    invoke    CreateFile,,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,\
        FILE_ATTRIBUTE_ARCHIVE,0
        mov    hFile,eax
        invoke    GetFileSize,eax,0
    mov    FSize,rax
    invoke    GlobalAlloc,GPTR,eax
    mov    p,rax
    lea    r9d,szReadWrite
    and    qword ptr[rsp+20h],0
        invoke    ReadFile,hFile,eax,FSize
        invoke    CloseHandle,hFile
    invoke    RPC_SampleInterface_sampleFunc,bindingHandle,FSize,p
    jmp    wmBYE
wmSEND_ICO:mov    edx,p1
    invoke    FindResource,0,,RT_ICON; find the resource
    mov    hResource,rax
    invoke  SizeofResource,0,eax        ; get its size
    mov    FSize,rax
    inc    eax
    invoke    GlobalAlloc,GPTR,eax
    mov    p,rax
    mov    edi,eax
    invoke    LoadResource,0,hResource    ; load the resource
    invoke    LockResource,eax;pResource
    mov    esi,eax
    mov    byte ptr[rdi],CF_BITMAP
    inc    edi
    mov    rcx,FSize
    rep    movsb
    mov    rdx,FSize
    inc    edx
    invoke    RPC_SampleInterface_sampleFunc,bindingHandle,,p
    mov    ecx,256
    and    qword ptr[rsp+30h],LR_DEFAULTCOLOR;LR_DEFAULTCOLOR=0
    mov    [rsp+20h],rcx
    mov    [rsp+28h],rcx
    mov    rcx,p
    inc    ecx
    invoke  CreateIconFromResourceEx,,FSize,TRUE,30000h;270376,TRUE,30000h
    mov    [rsp+20h],rax
    invoke  SendDlgItemMessageA,hWnd,IDC_IMG1,STM_SETIMAGE,IMAGE_ICON
    xor    p1,11b
    jmp    wmBYE
wmSEND_TXT:invoke GlobalAlloc,GPTR,256
    mov    p,rax
    mov    byte ptr[rax],CF_TEXT
    inc    eax
    invoke  GetDlgItemTextA,hWnddlg,ID_TXT,eax,256
    inc    eax
    invoke    RPC_SampleInterface_sampleFunc,bindingHandle,eax,p
    jmp    wmBYE
wmINITDIALOG:mov hWnd,rcx
        invoke    GetProcessHeap
    mov     hHeap,rax
    invoke    GetDlgItem,hWnddlg,IDC_IMG1
    invoke    SendMessageA,eax,STM_SETIMAGE,IMAGE_ICON,lParam
;setup Rpc-----------------------------
    lea    ecx,stringBinding
    mov    [rsp+28h],rcx
    movr    qword ptr[rsp+20h],security
    mov    r9d,offset endpoint
    mov    edx,offset protocol
    invoke    RpcStringBindingComposeA,0,,0
    or    eax,eax;eax=RPC_S_OK?
    jne    wmBYE
    mov    edx,offset bindingHandle
    invoke    RpcBindingFromStringBindingA,stringBinding
        invoke    RpcStringFreeW,&stringBinding
    or    eax,eax;eax=RPC_S_OK?
    jne    wmBYE
;----------------------------------------------------
    cmp    bindingHandle,0
    jnz    wmBYE
    mov    r8d,offset szWin
    mov    ecx,offset Error
    invoke    MessageBoxA,hWnd,,,MB_OK
    jmp    wmBYE
wmCOMMAND:cmp    r8d,BN_CLICKED shl 16 + ID_SEND_TXT
        je      wmSEND_TXT
        cmp    r8d,BN_CLICKED shl 16 + ID_SEND_WAV
        je      wmSEND_WAV
        cmp    r8d,BN_CLICKED shl 16 + ID_SEND_ICO
    je      wmSEND_ICO
    cmp     r8d,BN_CLICKED shl 16 + IDCANCEL
        jne     wmBYE
wmCLOSE:invoke    EndDialog,,0
    mov    ecx,offset bindingHandle
    invoke    RpcBindingFree
wmBYE:    mov    eax,TRUE
exit0:    leave
    retn
DialogProc endp
RPC_SampleInterface_sampleFunc proc bindingHandle:qword,bufferLength:dword,buffer:qword

        mov    [rsp+20h],r8;buffer
        mov    r9d,edx;bufferLength
        mov    r8,rcx;bindingHandle
        lea    rdx, RPC_SampleInterface__MIDL_ProcFormatString
        lea    rcx,RPC_SampleInterface_StubDesc ; pStubDescriptor
        invoke    NdrClientCall2
        leave
        retn
RPC_SampleInterface_sampleFunc endp

MIDL_user_allocate proc len:qword
    mov    r8d,ecx
    invoke    RtlAllocateHeap,hHeap,0
    leave
    ret
MIDL_user_allocate endp
MIDL_user_free proc lpMem:qword
    mov    r8d,ecx
    invoke    HeapFree,hHeap,0
    leave
    ret
MIDL_user_free endp
;---------------------------------------
.data
szWin        db 'Remote Procedure Call Reciever',0
Error        db "Unable to setup an RPC connection, exiting...",0
bindingHandle    dq ?
hWnd        dq ?
protocol    db "ncalrpc",0
endpoint    db "{46E785FC-BCCC-46B8-B161-D6C90D391670}",0; // Unique user-defined endpoint ID in a free form
security    db "Security=impersonation static false",0
p    dq ?
p1      dd 1
RPC_SampleInterface__MIDL_ProcFormatString:
    db 0
    db 48h    ; H
    dd 0
    dw 0
    dw 18h
    db 32h,    0
    dw 0
    dw 8
    dw 0
    db 42h,2,10,5
    dw 0
    dw 1
    dw 0
    dw 0
    dw 48h
    dw 8
    db 8, 0
    dw 10Bh
    dw 10h
    dw 6
    db 0
RPC_SampleInterface_StubDesc:
    dq RPC_SampleInterface___RpcClientInterface; RpcInterfaceInformation
    dq MIDL_user_allocate;    pfnAllocate
    dq MIDL_user_free; pfnFree
    dq RPC_SampleInterface__MIDL_AutoBindHandle; IMPLICIT_HANDLE_INFO.pAutoHandle
    dq 0            ; apfnNdrRundownRoutines
    dq 0            ; aGenericBindingRoutinePairs
    dq 0            ; apfnExprEval
    dq 0            ; aXmitQuintuple
    dq RPC_SampleInterface__MIDL_TypeFormatString; pFormatTypes
    dd 1            ; fCheckBounds
    dd 50002h        ; Version
    dq 0            ; pMallocFreeStruct
    dd 8010274h        ; MIDLVersion
    db 4 dup(0)
    dq 0            ; CommFaultOffsets
    dq 0            ; aUserMarshalQuadruple
    dq 0            ; NotifyRoutineTable
    dq 1            ; mFlags
    dq 0            ; CsRoutineTables
    dq 0            ; ProxyServerInfo
    dq 0            ; pExprInfo
RPC_SampleInterface___RpcClientInterface label RPC_CLIENT_INTERFACE
    dd sizeof RPC_CLIENT_INTERFACE;Length struct;+0
    GUID <8A4A7813h,0ADAAh,49BCh,{99h,6Ah,4Dh,47h,71h,5Fh,0CAh,40h}>
    RPC_VERSION <1,0>
    GUID <8A885D04h,1CEBh,11C9h,{9Fh,0E8h,8,0,2Bh,10h,48h,60h}>
    RPC_VERSION <2,0>
    dd 0;+2C
    dq 0;  PRPC_DISPATCH_TABLE   DispatchTable;+30h
    dd 0,0;  unsigned int          RpcProtseqEndpointCount;+38h
    dq 0;  PRPC_PROTSEQ_ENDPOINT RpcProtseqEndpoint;+40h
    dq 0;  ULONG_PTR             Reserved;+48h
    dq 0;  void const            *InterpreterInfo;+50h
    dq 0;+58h
    dd 0;unsigned int          Flags;+5Ch
RPC_SampleInterface__MIDL_AutoBindHandle dq 0,0
RPC_SampleInterface__MIDL_TypeFormatString:
    dw 0
    db 11h,0
    dw 2
    db 1Bh,0
    dw 1
    db 29h,0
    dw 8
    dw 1
    db 2,5Bh,0
;-------------------------------
hHeap    dq ?
wav_file db '..\Images\03.wav',0
end
resources (14s.rc)#include "resource.h"
#define ID_TXT       100
#define ID_SEND_TXT  101
#define ID_SEND_ICO  102
#define ID_SEND_WAV  103
#define IDC_IMG1     104

#define IDC_DIALOG   200
#define IDC_ICON1    500

IDC_ICON1 ICON "..\\Images\\icon1.ico"
IDC_ICON2 ICON "..\\Images\\icon2.ico"

IDC_DIALOG DIALOG 0, 0, 212, 140
STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX |
WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK
CAPTION "Remote Procedure Call Sender"
BEGIN
    CONTROL "",-1,"BUTTON",BS_GROUPBOX, 2, -1, 207, 24
    CONTROL "",IDC_IMG1,"Static",WS_CHILDWINDOW | WS_VISIBLE | SS_ICON,5,23,128,128
    CONTROL "Write something and click 'Send Text'",ID_TXT,"EDIT",WS_BORDER | WS_TABSTOP |  ES_AUTOHSCROLL,5,7,199,13
    DEFPUSHBUTTON   "Send Text",ID_SEND_TXT,149,27,60,15
    PUSHBUTTON      "Send ICO", ID_SEND_ICO,149,45,60,15
    PUSHBUTTON      "Send WAV", ID_SEND_WAV,149,65,60,15
    PUSHBUTTON      "Exit",     IDCANCEL,   149,85,60,15
END
in attachment ASM-/RC-/EXE-files

Mikl__

Hi All!
Quote14.zip (246.48 kB - downloaded 4 times.)
Sluggish reaction, I spent a whole month on this example for Remote Procedure Call Typical quantity of downloads 19-20. Most likely, interest in Interprocess communication is lost...

Greenhorn

Quote from: Mikl__ on October 03, 2022, 10:05:24 PM
Hi All!
Quote14.zip (246.48 kB - downloaded 4 times.)
Sluggish reaction, I spent a whole month on this example for Remote Procedure Call

Hi Mikl,

I guess it's becausee the folks are overwhelmed by this example.

Absolutely great what you did on this tutorial.  :thumbsup:

Sample 14 works fine except the "Send WAV" gives an exception.
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Biterider

Hi Mikl__
Quote from: Mikl__ on October 03, 2022, 10:05:24 PMSluggish reaction, I spent a whole month on this example for Remote Procedure Call... Most likely, interest in Interprocess communication is lost...
Absolutely not, RPC is technically a very important topic!

At this point I would like to thank you for all your efforts.  :thumbsup:


Biterider

jj2007

Mikl,

You are doing a great job, a service for the community, and I am sorry that I don't have the time to follow your tutorials more thoroughly.

Thank you :thup:

Jochen

Mikl__

Hi Biterider and Greenhorn!
Thanks for answers!
Greenhorn
where is the 03.wav file?
Remote Procedure Call
| |
| 14
| |
| + ---14r.exe
| +---14s.exe
|
Images
  |
  +--- 03.wav
Ciao jj2007!
Judging by the addresses on your dump, the crash happens somewhere inside the rpcrt4.dll While I can't tell what is causing the error, I need to trigger it on some other computer. Most likely that the error is due to the fact that the transferred pictures have a size of 270K and the wav file has a size of 1.6M

Greenhorn

Quote from: Mikl__ on October 03, 2022, 10:52:40 PM
Hi Biterider and Greenhorn!
Thanks for answers!
Greenhorn
where is the 03.wav file?
Remote Procedure Call
| |
| 14
| |
| + ---14r.exe
| +---14s.exe
|
Images
  |
  +--- 03.wav


It's missing.  :tongue:

My download folder is full of stuff. I have to search for the other parts of the tutorial ...
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

jj2007

Copy any wav file to ..\Images\03.wav, and tut14 will work fine :thumbsup: