Thursday, August 27, 2009

Small DCOM "things" regarding custom marshaling, size_is

Have problems with DCOM? size_is or length_is are not working? From the whole array passed as byte* parameter only the first byte is reaching the COM server or client? You need to create the proxy/stub DLL (http://www.biztalkgurus.com/blogs/biztalksyn/archive/2006/02/28/COM-proxy-stub-dll-and-why-do-you-need-it.aspx) and register it on the both systems. TLB doesn't contains the exact parameters definition (like size_is), so without this proxy/stub (which defines Custom Marshaler for your COM component) COM doesn't know how to correctly pass your data over the border.

--- in Russian :) ---
Мучаетесь с DCOM? Не работают size_is и length_is? Из массива-параметра (например byte*) передаеться только 1 байт? Вам необходимо сделать proxy/stub dll (http://www.biztalkgurus.com/blogs/biztalksyn/archive/2006/02/28/COM-proxy-stub-dll-and-why-do-you-need-it.aspx), и зарегить её на обоих системах. Проблема в том что TLB не содержит всего богатства информации о параметрах, например size_is и т.д. и без proxy/stub COM не знает как маршалить данные.

Wednesday, June 24, 2009

I've almost finished removing any traces of CRT usage from my DLL (yes, another fight to get less than 4k integration module ;), when become stuck with _memset usage somewhere. Assembly language output turned on, and... omg...

 ; 75   :  OPENFILENAME ofn;
 ; 76   :  for (int b = 0; b < sizeof(ofn); b++)
 ; 77   :   ((byte*)&ofn)[b] = 0;
00014 6a 58                push 88 ; 00000058H
00016 8d 44 24 14      lea eax, DWORD PTR _ofn$[esp+108]
0001a 53                     push ebx
0001b 50                     push eax
0001c 88 1e                 mov BYTE PTR [esi], bl
0001e e8 00 00 00 00  call _memset
00023 83 c4 0c            add esp, 12 ; 0000000cH

Hm... That wasn't what I asked for, actually :)

P.S. To say truth, I've spent almost half an hour trying to fool compiler to leave my cycle untouched. Simple math operations doesn't help (beside MOD variants), the easiest solution was to reverse cycle :D