I am trying to use StrAllocSecure to insure that an LPWSTR has sufficient
buffer size to subsequently try and copy a  CRYPT_INTEGER_BLOB
<https://msdn.microsoft.com/en-us/library/windows/desktop/aa381414(v=vs.85).aspx>
  
structure's buffer into the LPWSTR, for the purpose of passing this to
WcaAddTempRecord (after prepending L"#x").

When I call StrAllocSecure (or related functions) I then hit code in
AllocHelper which returns E_OUTOFMEMORY.  The blob size, for this test, is
154 bytes (and I tried adding more to it as a test, for a cch around 195,
decimal).  When I add 'DWORD test =  MAXDWORD / sizeof(WCHAR);' to a source
file it evaluates to 2,147,483,647 so I do not understand why the if block
evaluates as TRUE in AllocHelper at:

    if (cch >= MAXDWORD / sizeof(WCHAR))
    {
        hr = E_OUTOFMEMORY;
        ExitOnFailure1(hr, "Not enough memory to allocate string of size:
%u", cch);
    }

Any thoughts? (and any advice on how to use StrUtil (or other wix lib) to
insert the blob BYTE array into a LPWSTR for WcaAddTempRecord.  It would be
so cool to let MSI manage the rollback rather than writing a deferred CA to
call win32 registry api.)

Thanks for your time!
FYI - I am using wix 3.10.0.1502 at this time.




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/StrAllocSecure-fails-in-AlocHelper-advice-in-understanding-why-tp7600708.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to