Re: WMI question

Stoyan Damov <[email protected]>
Newsgroups gmane.comp.windows.off-topic
Message-ID <[email protected]>
Can't you just debug it and see the stack trace, what the caller passes, and
if wcslen is not passed a null pointer (I can almost bet my ass on that)?

Cheers

On Fri, Dec 3, 2010 at 10:49 PM, John Smith <[email protected]> wrote:

>
>
> Hi guys,
>    I am working on a WMI application that keeps crashing when I perform
> certain queries. The program will eventually perform 349 different types of
> WMI queries, but at this point it only successfully works for a limited
> number of those. I have written the project framework and have all the
> needed functionality already included, the code compiles cleanly and works
> perfectly when I query for certain things such as all running processes, but
> it crashes with an access violation when I run various other queries. One
> query that crashes the program is the Win32_AccountSID. I am running this
> code from an administrator account on an XP Pro Sp2 machine and I am using
> MSVC6.0 Professional compiler.
>
>   I can send my code to anyone that might be able to help with this problem
> if they need it. I break into the debugger when the program crashes and this
> is the code that seems to be causing the problem:
>
> size_t __cdecl wcslen (
>         const wchar_t * wcs
>         )
> {
>         const wchar_t *eos = wcs;
>         while( *eos++ ) ;    //here is where the instruction pointer is
> pointing when the debugger loads
>         return( (size_t)(eos - wcs - 1) );
> }
>
>
> I'm wondering if the information I am querying for (i.e. Win32_AccountSID)
> in this case, is returning information that is not what the wcslen( ) is
> expecting... Why else would the 'eos' pointer incrementation cause the
> access violation?  Any ideas?
>
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.