What build are you using?

From: Michael Osmond [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 14, 2006 17:35
To: wix-users@lists.sourceforge.net; Rob Mensching
Subject: Testing the ConfigureSQL fix

Hello Rob,

I only got back to testing this today - one busy week.

Build 4809 displayed a similar (or same) error - that is the custom action 
crashes and you get the unclosed handles.  I have spent a little time to track 
down where in the code it is occuring.

Its in StrAllocStringAnsi - but now right at the start of the process.   In the 
call:

        cch = MemSize(*ppwz);  // get the count in bytes so we can check if it 
failed (returns -1)
Below is the debug messages I added to the function to locate the error.  And 
below that the actual output.

Sorry its taken this long to get to it.

Michael

=============================================

/********************************************************************
StrAllocStringAnsi - allocates or reuses dynamic string memory and copies in an 
existing ANSI string

NOTE: caller is responsible for freeing ppwz even if function fails
NOTE: cchSource must equal the length of wzSource (not including the NULL 
terminator)
NOTE: if cchSource == 0, length of wzSource is used instead
********************************************************************/
extern "C" HRESULT DAPI StrAllocStringAnsi(
    __inout LPWSTR* ppwz,
    __in LPCSTR szSource,
    __in DWORD_PTR cchSource,
    __in UINT uiCodepage
    )
{
    Assert(ppwz && szSource);

    HRESULT hr = S_OK;
    LPWSTR pwz = NULL;
    DWORD_PTR cch = 0;
    DWORD_PTR cchDest = cchSource;  // at least enough

OutputDebugStringA("#### Starting StrAllocStringAnsi !! 4809 x 2\r\n");


    if (*ppwz)
    {
OutputDebugStringA("#### StrAllocStringAnsi 0\r\n");
        cch = MemSize(*ppwz);  // get the count in bytes so we can check if it 
failed (returns -1)
OutputDebugStringA("#### StrAllocStringAnsi 0-A\r\n");
        if (-1 == cch)
        {
            ExitOnFailure(hr = E_INVALIDARG, "failed to get size of destination 
string");
        }
OutputDebugStringA("#### StrAllocStringAnsi 0-B\r\n");
        cch /= sizeof(WCHAR);  //convert the count in bytes to count in 
characters
OutputDebugStringA("#### StrAllocStringAnsi 0-C\r\n");
    }

OutputDebugStringA("#### StrAllocStringAnsi 1\r\n");
    if (0 == cchSource)
    {
        cchDest = ::MultiByteToWideChar(uiCodepage, 0, szSource, -1, NULL, 0);
        if (0 == cchDest)
        {
            ExitWithLastError1(hr, "failed to get required size for conversion 
to unicode: %s", szSource);
        }

        --cchDest; //subtract one because MultiByteToWideChar includes space 
for the NULL terminator that we track below
    }
    else if (L'\0' == szSource[cchSource]) // if the source already had a null 
terminator, don't count that in the character count because we track it below
    {
        cchDest = cchSource - 1;
    }
OutputDebugStringA("#### StrAllocStringAnsi 2\r\n");

    if (cch < cchDest + 1)
    {

OutputDebugStringA("#### StrAllocStringAnsi 3\r\n");

        cch = cchDest + 1;
        if (cch >= MAXDWORD / sizeof(WCHAR))
        {
OutputDebugStringA("#### StrAllocStringAnsi 4\r\n");
            ExitOnFailure1(hr = E_OUTOFMEMORY, "Not enough memory to allocate 
string of size: %d", cch);
        }

        if (*ppwz)
        {
OutputDebugStringA("#### StrAllocStringAnsi 5\r\n");
            pwz = static_cast<LPWSTR>(MemReAlloc(*ppwz, sizeof(WCHAR) * cch, 
TRUE));
        }
        else
        {
OutputDebugStringA("#### StrAllocStringAnsi 6\r\n");
            pwz = static_cast<LPWSTR>(MemAlloc(sizeof(WCHAR) * cch, TRUE));
        }

        ExitOnNull1(pwz, hr, E_OUTOFMEMORY, "failed to allocate string, len: 
%d", cch);

OutputDebugStringA("#### StrAllocStringAnsi 7\r\n");
        *ppwz = pwz;
    }
OutputDebugStringA("\r\nAbout to call!! 4809");

    if (0 == ::MultiByteToWideChar(uiCodepage, 0, szSource, 0 == cchSource ? -1 
: (int)cchSource, *ppwz, (int)cch))
    {
        ExitWithLastError1(hr, "failed to convert to unicode: %s", szSource);
    }
OutputDebugStringA("\r\nDone the call!!");

    (*ppwz)[cchDest] = L'\0';

LExit:
    return hr;
}

1204: ConfigureSql:  #### Doing script: 'drop_TriggersConstraints'
1204: ConfigureSql:  #### ScaSqlStr - Calling StrAllocStringAnsi
1204: #### Starting StrAllocStringAnsi !! 4809 x 2
1204: #### StrAllocStringAnsi 0
1204: ConfigureSql:  Debug Assert Message: Assertion failed in c:\baydev\install
\wix2.0.4809\src\ca\wcautil\wcautil.cpp, 64
CustomAction ConfigureSql called WcaInitialize() but not WcaTerminate()

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to