BazisLib 2.3.0 Setup Error [FIXED]

Sysprogs forums Forums Other tools & products BazisLib 2.3.0 Setup Error [FIXED]

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #102
    airmax
    Participant

    After BazisLib-2.3.0.exe finises, its seems it call BazisLibSetup.exe from target directory.
    BazisLibSetup.exe causes error on load:

    I press debug and here is some data from VS:
    Call stack:

    
    >	System.Windows.Forms.dll!System.Windows.Forms.ComboBox.ObjectCollection.AddInternal(object item) + 0x17a bytes
    System.Windows.Forms.dll!System.Windows.Forms.ComboBox.ObjectCollection.Add(object item) + 0x1c bytes
    BazisLibSetup.exe!BazisLibSetup.SetupWizardForm.DetectDDKLocations() + 0x123 bytes
    BazisLibSetup.exe!BazisLibSetup.SetupWizardForm.SetupWizardForm() + 0x39 bytes
    BazisLibSetup.exe!BazisLibSetup.Program.Main() + 0x33 bytes

    Exception:

    
    System.ArgumentNullException:
    Value can't be undefined.
    Parameter name: item
    

    I have WDK installed and registered WDKPATH env. variable.
    Let me know if i can provide more details. Library look interesting, want to try it.

    #1128
    airmax
    Participant

    Replying to myself.

    Author include sources of BazisLibSetup(supportBazisLibSetup) i dont pay any attention from beginning.

    Error reproduced if DDK not installed, but WDK installed:

    SetupWizardForm.cs

    
    90:            if (DDKPath != null)
    91:                cbDDKPATH.Items.Add(DDKPath);
    92:            if (WDKPath != null)
    93:                cbDDKPATH.Items.Add(DDKPath);
    

    To fix error, change line 93 as following

    
    93:                cbDDKPATH.Items.Add(WDKPath);
    

    Bazis(sorry, dont know your name), please merge this fix for future.

    P.S. Can you setup forum engine to correctly work with Russian symbols, and quotation marks.

    #1129
    support
    Keymaster

    Oops. Saw the post too late. Already fixed, will be included in next version installer. As for the quotation marks & unicode symbols, maybe will do it later, however, I’m not that good in PHP, as in kernel development ๐Ÿ˜‰

    #1130
    airmax
    Participant

    @bazis wrote:

    .. as in kernel development ๐Ÿ˜‰

    ๐Ÿ˜†

    #1131
    support
    Keymaster

    ๐Ÿ˜ฎ ??? If something about kernel-mode part of BazisLib is bad, a bugreport/wishlist would be much better than undirected sarcasm.

    #1132
    airmax
    Participant

    ๐Ÿ˜ณ I misread “as in” i read as “and in” and think that you underrate yourself. Quite the contrary i see, researching lib, you have good experience of KM development.
    I have about 4 years of driver development experience, but still not write own framework or lib(set of C functions is not framework).

    Also, i have no C++ kernel driver development experience(Generally, have small. Using NuMega DriverStudio, and thats not best experience because of problems i have using it).
    So, im serious to try C++ in KM. Btw, can i use STLPort provided by installer separately? Or its uses as part of BasizLib only?
    Sorry, one more question. Can you please give some advices of C++ usage(Compiler flags, objects creation, something also)?

    #1133
    support
    Keymaster

    Surely you can use the STLPort without BazisLib, however you will need the code that calls static C++ constructors/destructors, that can be easily separated from BazisLib.
    As for the compiler flags & etc, I would recommend avoiding exceptions in kernel mode, as using them has quite an impact on performance and stack requirement. Check out the VisualDDK project wizard, it allows creating Visual Studio driver projects without a link to BazisLib.
    Finally, regarding object creation & programming style, I could only suggest being sure, what will the optimizing compiler produce from your C++ code, and checking the disassembly in case of a smallest doubt. Anyway, it is possible to make C++ programs as efficient/small as C ones with much less coding effort, however it requires checking the disassembly, as the optimizer is not always perfect.
    See WinCDEmu sources for a (relatively) simple example of a C++ kernel driver.

    #1134
    airmax
    Participant

    Thanks for advice.
    I read a lot of info about C++ in KM, and now i completely mesh.

    Somewhere i read that, to use C++ in KM “C++ runtime” required, for example htscpp from hollistech or CppLib. So, i can’t get, i need it or not?

    #1135
    support
    Keymaster

    You need a special “runtime” libraries to use exceptions. For other purposes (static/global constructors & etc.), the BazisLib startup file is enough.

    #1136
    airmax
    Participant

    Thanks for advice.

    #1137
    airmax
    Participant

    Btw, i just try BazisLib::DDK Driver Wizard.
    As i see its generate new and delete insructions, is this is ok? I reed they must be avoided. Or its controlled by included basizlib?

    #1138
    support
    Keymaster

    It is managed by BazisLib. You can see the stlsup.cpp file for new() and delete() implementation. However, note that if you need to allocate objects from non-paged pool, you should use the npagednew() function instead (or, more preferably, overload the new() operator for your specific class, that always needs to be allocated from non-paged pool; for example, see the irpqueue.h file). The standard C malloc()/free() implementations are provided as well for compatibility reasons.

    #1139
    airmax
    Participant

    It is managed by BazisLib. You can see the stlsup.cpp file for new() and delete() implementation.

    So, if i understand correctly, i can use new/delete/npagednew in KM C++ if i include stlsup.cpp?

    Just try DDKWizard, why you not use RTL_CONSTANT_STRING to define DeviceName and Win32Device instead of RtlInitUnicodeString?

    UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\Device\DevName");
    UNICODE_STRING Win32Device = RTL_CONSTANT_STRING(L"\DosDevices\DevName");
    
    #1142
    support
    Keymaster

    So, if i understand correctly, i can use new/delete/npagednew in KM C++ if i include stlsup.cpp?

    Yes. Otherwise you will simply get a linker error stating that “operator new()” is undefined.

    Just try DDKWizard, why you not use RTL_CONSTANT_STRING to define DeviceName and Win32Device instead of RtlInitUnicodeString?

    Sample files for DDKWizard were copy-pasted from some very old stuff without any refactorring. Anyway, thanks for the advice, I’ll probably update the samples.

    #1140
    airmax
    Participant

    Also, small memory optimization can be added by placing DriverEntry to INIT section, so it will be unloaded after driver start:

    #ifdef ALLOC_PRAGMA
    #pragma alloc_text (INIT, DriverEntry)
    #endif // ALLOC_PRAGMA
    

    Also, i think that cmd files which use system build in utility sc to register/run/stop/remove legacy driver will be more flexible than registry file.

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.