Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Tue, 30 May 2006 10:22:48 +0530,    group: microsoft.public.platformsdk.com_ole        back       


how to test difference made by MIDL /robust   
Hi ,
I am new to writing COM objects and am required to make COM objects whose
IDLs are compiled with MIDL "/robust" switch .
I am  also required to write a client that tests the difference made due to
the use of the "/robust" flag.
I have written a simple component using ATL ( DLL) and  I compiled the
project with a custom build setting for the idl file as
    midl /robust /Oicf /h "Server.h" /iid "Server_i.c" "Server.idl"



I have tried using the [range] attribute in a methos as well as a method
that takes correlated arguments as defined in MSDN i.e.
HRESULT Method1(
    [in, range(0,100)] ULONG m,);



HRESULT Func1([in] long Size,
              [in, size_is(Size)]BAR_TYPE *pBarType);
In both cases , i dont notice any difference in execution of the client that
uses this server obect when the arguments
passed are erronous ,ie in the first case the argument "m" is not in the
specified range and in the second case,there is a mismatch in the
 "Size" argument and the actual size array . (Size is larger than the actual
chunk).


Should it be throwing a run time error/exception ? or is it behaving as
expected ?



I tried to compile a DCOM object (downloaded code) with the "/robust" switch
for its idl which gave me the following error.
c:\program files\microsoft visual studio\vc98\include\rpcndr.h(58) : fatal
error C1189:
#error :  incorrect <rpcndr.h> version. Use the header that matches with the
MIDL compiler.
This code comiles fine witout the robust switch.


I am using winnt2000 with SP 4 .
How do i test the difference made by the /robust flag .
date: Tue, 30 May 2006 10:22:48 +0530   author:   Jetender

Re: how to test difference made by MIDL /robust   
"Jetender"  wrote in message
news:%23GwSqT6gGHA.1792@TK2MSFTNGP03.phx.gbl
> I am new to writing COM objects and am required to make COM objects
> whose IDLs are compiled with MIDL "/robust" switch .
> I am  also required to write a client that tests the difference made
> due to the use of the "/robust" flag.
> I have written a simple component using ATL ( DLL) and  I compiled the
> project with a custom build setting for the idl file as
>    midl /robust /Oicf /h "Server.h" /iid "Server_i.c" "Server.idl"
>
> I have tried using the [range] attribute in a methos as well as a
> method that takes correlated arguments as defined in MSDN i.e.
> HRESULT Method1(
>    [in, range(0,100)] ULONG m,);
>
> HRESULT Func1([in] long Size,
>              [in, size_is(Size)]BAR_TYPE *pBarType);
> In both cases , i dont notice any difference in execution of the
> client that uses this server obect when the arguments
> passed are erronous ,ie in the first case the argument "m" is not in
> the specified range and in the second case,there is a mismatch in the
> "Size" argument and the actual size array . (Size is larger than the
> actual chunk).

/robust does not protect against parameters out of range and such - a 
proxy/stub pair built with /no_robust does that, too. /robust protects 
agaisnt certain malformed NDR (Network Data Representation) packets. Of 
course, you cannot simulate bad packets by building your client with 
MIDL - MIDL-generated code will always produce well-formed packets 
(assuming there are no bugs in MIDL, of course).

To test a difference between /robust and /no_robust, you would have to 
go to a lower level and essentially implement RPC client yourself from 
scratch, then intentionally break it to generate data packets malformed 
in a certain way.

RPC specification is here: http://www.opengroup.org/onlinepubs/9629399/ 
.. WINE (http://www.winehq.com/) and Samba (http://www.samba.org) should 
have RPC implementation available in source code that you could modify.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Tue, 30 May 2006 08:50:18 -0400   author:   Igor Tandetnik

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us