Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 SAL annotation suppression broken again
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

CGAllred
New Member

8 Posts

Posted - Oct 03 2018 :  7:47:04 PM  Show Profile  Reply with Quote
VA_X.dll file version 10.9.2291.0 built 2018.09.21
DevEnv.exe version 15.8.28010.2041 Enterprise

This is an issue that has happened in the past and it is happening again. Code that has the _IRQL_requires_max_ and/or _When_ SAL annotations doesn't show up properly in the VA Outline. The SAL annotations show up instead of the routine name.

For example, this shows up properly in the VA Outline:


_Must_inspect_result_
BOOLEAN
FLTAPI
FltDoCompletionProcessingWhenSafe(
    _In_ PFLT_CALLBACK_DATA Data,
    _In_ PCFLT_RELATED_OBJECTS FltObjects,
    _In_opt_ PVOID CompletionContext,
    _In_ FLT_POST_OPERATION_FLAGS Flags,
    _In_ PFLT_POST_OPERATION_CALLBACK SafePostCallback,
    _Out_ PFLT_POSTOP_CALLBACK_STATUS RetPostOperationStatus
    );


This does not:


_Must_inspect_result_
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
FLTAPI
FltPurgeFileNameInformationCache (
    _In_ PFLT_INSTANCE Instance,
    _In_opt_ PFILE_OBJECT FileObject
    );

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Oct 04 2018 :  3:22:27 PM  Show Profile  Reply with Quote
Can you please try these two examples in an empty .h file in your solution, both of these are showing correctly for me, testing in VS2017 with VA 2291.0

So I am wondering if this could be a file or solution specific effect.

zen is the art of being at one with the two'ness
Go to Top of Page

CGAllred
New Member

8 Posts

Posted - Oct 04 2018 :  3:54:08 PM  Show Profile  Reply with Quote
I get the correct results in an otherwise empty .h file outside of any solution, but I get the bad results in an otherwise empty .h file in my solution(s).

Both of those function signatures are from the WDK fltKernel.h file. I tried to repro by creating a new Filesystem Mini-filter project from the WDK, but the VA Outline shows up properly in that file with a new project.

So it looks like it might have to do with my solutions. They're all Open Folder type, rather than New Project type.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Oct 05 2018 :  07:06:52 AM  Show Profile  Reply with Quote
At a guess there is a macro in your main solution that is overlapping with one of these terms. To test this can you please open two instances of the IDE, with your main solution open in the first instance, and in the second instance of the IDE just open the single test .h file.

If you now place the caret into each symbol in turn in both IDE's, are you seeing any obvious differences between the two IDE's, in terms of symbol colour and what is shown in the VA Context and Definition fields? These fields are normally shown at the top of the editor window, and are where the alt-m list appears.

If one of these symbols is being defined differently in your main solution, hopefully this will show up quickly and easily here, and we can then work from there.

zen is the art of being at one with the two'ness
Go to Top of Page

CGAllred
New Member

8 Posts

Posted - Oct 05 2018 :  2:57:42 PM  Show Profile  Reply with Quote
What you suggested got me thinking, so I tried something related. Looking in the VA Context and Definition fields I could see that the IDE thought the definition of _IRQL_requires_max_ was in another header in the solution. That header only contains a couple prototypes so that I can avoid #including the header they're actually in:


_IRQL_requires_max_(PASSIVE_LEVEL)
NTSYSAPI
NTSTATUS
NTAPI
ZwQueryWnfStateData(
    _In_ PCWNF_STATE_NAME StateName,
    _In_opt_ PCWNF_TYPE_ID TypeId,
    _In_opt_ const VOID* ExplicitScope,
    _Out_ PWNF_CHANGE_STAMP ChangeStamp,
    _Out_writes_bytes_to_opt_(*BufferSize, *BufferSize) PVOID Buffer,
    _Inout_ PULONG BufferSize
    );

_IRQL_requires_max_(PASSIVE_LEVEL)
NTSYSAPI
NTSTATUS
NTAPI
ZwUpdateWnfStateData(
    _In_ PCWNF_STATE_NAME StateName,
    _In_reads_bytes_opt_(Length) const VOID* Buffer,
    _In_opt_ ULONG Length,
    _In_opt_ PCWNF_TYPE_ID TypeId,
    _In_opt_ const PVOID ExplicitScope,
    _In_ WNF_CHANGE_STAMP MatchingChangeStamp,
    _In_ LOGICAL CheckStamp
    );


I deleted the _IRQL_requires_max_ lines from those prototypes and the functions using _IRQL_requires_max_ in my .c files started showing up correctly in the VA Outline. They continued to show up correctly after adding _IRQL_requires_max_ back to the prototypes.

I suspect that the "fix" won't stick though. How can I force VA to re-parse the whole solution from scratch to verify?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Oct 06 2018 :  08:05:22 AM  Show Profile  Reply with Quote
Interesting. To get VA to reparse everything simply press the button:

VA Options -> Performance -> Rebuild symbol databases

and restart the IDE. This will reparse the solution, plus all of VA's stable include directories.

To just reparse the solution, but not the stable include directories make sure you have:

VA Options -> Performance -> Parse all files when opening a project

turned On and then restart the IDE and reload the solution. VA does try to be aware of which files have been changed since last time we did a parse though, so this may not be enough, depending on exactly is going on here.

If there is a bit of code in one of the header files that is confusing VA when we see it, it is possible to hide code from our parser, but it will require a couple of changes to your source code to achieve.

zen is the art of being at one with the two'ness
Go to Top of Page

CGAllred
New Member

8 Posts

Posted - Oct 09 2018 :  2:53:21 PM  Show Profile  Reply with Quote
Can I hide the code without removing the SAL annotations?

Is there anything I can do to help gather information on what's causing the parser to get confused?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Oct 10 2018 :  06:58:41 AM  Show Profile  Reply with Quote
It depends on what the trigger for all of this is. If hiding the content of the single header file that contains its own definition of _IRQL_requires_max_ is enough, then placing the following code at the top of the file should work:

#if 1 == 0
_asm {
#endif


this will be stripped out when compiling, but VA works to parse inside inactive code blocks, so will see this code, and should then ignore the rest of the file, on the basis that it is assembly code, so the definitions here won't end up in VA's symbol database, and won't cause any further problems.

Are you able to edit this header file, to see if this fixes the problem?

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000