Why ovaldi is .net framework 4 dependent?

Help
2012-10-17
2013-09-26
  • Manfred von Runkel

    Hi!

    I would like to know why ovaldi is .net 4 dependent? Is there any possibility to remove this dependency? For example, on src\windows\probe, those files are .net 4 dependent due some windows features?

    Thank You

     
  • Danny Haynes

    Danny Haynes - 2012-10-18

    Hi,

    The Windows build of the OVAL Interpreter is dependent on .NET because we use a .NET PowerShell API to implement the cmdlet_test.

    If you remove the cmdlet_test, you should be able to remove the .NET dependency.

    Let us know if you have any other questions.

    Thanks,

    Danny

     
  • Manfred von Runkel

    Hi djaynes

    I commented all cmelet probe, but aniway it uses the .Net

    What sould i configure on Visual Studio 2010 to remove the .net dependency?

    Thank You!

     
  • Manfred von Runkel

    Hi Djaynes,

    I set the project to:

    Common Language Runtime Support = No Common Language Runtime Support
    Enable Incremental Linking = NO

    And commented on main.c

    HRESULT hres =  CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);

    Then i was able to run on Windows 2003 Server without .net4, but i dont know if works right, because the systemcharacteritcs contains only:

    oval-sc:message>Error: RegCloseKey() was unable to close the handle. Microsoft System Error 0) - The operation completed successfully.</oval-sc:message>

    Thank You

     
  • Michael Chisholm

    Hmm… there's actually a display bug there.  An error did occur, but it was not described properly in that error message.  I will fix that for the next release.  As for whether it worked properly, it might have, depending on what actually happened.  I don't know what content you ran against.  Does it display that same error for all registry-related definitions?  Do other types of definitions work ok?  Are you running ovaldi with admin privileges?

    Andy

     
  • Manfred von Runkel

    Hi chishomi,

    Let's context you about what is happening:

    My Objective: Remove .net4 dependency

    What I've done:
    -Common Language Runtime Support = No Common Language Runtime Support
    - Enable Incremental Linking = NO

    So, i've tried to run on my Windows 7 x64 (the .net 4 is installed) . It doesn't work with the CoInitializeSecurity.
    I commented it and it worked, it generates the result.

    Then, ive tried on the Windows 2003 x64 Server with net 2. It worked, but the system-characteristcs.xml contains on almost:

    <object flag="error" id="oval:org.mitre.oval:obj:1002" version="1"><oval-sc:message>Error: RegCloseKey() was unable to close the handle. Microsoft System Error 0) - The operation completed successfully.</oval-sc:message><oval-sc:message>ObjectComponent::ComputeValue() - Unable to compute variable value. No items found for the specified object_component id: oval:org.mitre.oval:obj:219</oval-sc:message></object><object flag="error" id="oval:org.mitre.oval:obj:1070" version="3"><oval-sc:message>Error: RegCloseKey() was unable to close the handle. Microsoft System Error 0) - The operation completed successfully.</oval-sc:message><oval-sc:message>ObjectComponent::ComputeValue() - Unable to compute variable value. No items found for the specified object_component id: oval:org.mitre.oval:obj:5169</oval-sc:message></object>
    

    I really dont know what to do… i dont know i configured the project wrong, or this commented CoInitializeSecurity makes something goes wrong.

    Thank you

     
  • Manfred von Runkel

    oh, i almost forgot, i dont have admin privileges on windows 7 and i have on windows 2003

     
  • Michael Chisholm

    If you don't have admin privileges, many things may not work properly.  That might possibly be related to your RegCloseKey() errors.

    As far as COM initialization, you should call CoInitialize() (or CoInitializeEx()) to initialize COM.  According to docs, you should call that before calling any other COM function.  I suspect that applies to CoInitializeSecurity() too.  See:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms678543%28v=vs.85%29.aspx

    It is true that you'd have to initialize COM yourself if you build as an unmanaged app; managed apps get COM initialized for them automatically, so we don't do it explicitly.

    Andy

     
  • Manfred von Runkel

    Sorry guys,

    the main problem about RegCloseKey(), is that im running the ovaldi.exe in a WINDOWS 2000 COMPATIBILITY option :/

    When i changed, it works (ok, but i have some other problems that i will post).

    About the .net framework anyway, i would like to know the best way to configure the project and build it properly.

    Thank You!

     
  • Michael Chisholm

    Sorry, you said you *do* have admin privileges on your Windows Server 2003 box.  I had that backwards…

    So I guess that's not the cause of your RegCloseKey() problem.  Unfortunately, without being able to see the actual error, it's hard to diagnose :-\

    Andy

     
  • Michael Chisholm

    Oh ok, glad you got past that error!

     
  • Michael Chisholm

    About the .net framework anyway, i would like to know the best way to configure the project and build it properly.

    We no longer support unmanaged ovaldi builds on Windows.  You only had to cut out the cmdlet probe this time, but there will undoubtedly be more probes written in the future to .NET APIs.  We don't have an easy turnkey solution to obtain an unmanaged build at present.  I think what you did is the only way to do it: cut out any probes written for .NET APIs, change the project settings, and add code to initialize COM.  The core ovaldi codebase should remain free of .NET dependencies, since it must be cross-platform.

    Andy

     
  • Manfred von Runkel

    Thank you for the support.

    I think i will open another post about the how to configure project specific for Oval without .net 4.

    Thank you

     
  • Manfred von Runkel

    Hi

    About my last post, it's very easy. It's only necessary to cut off the CMDLETProbe from the source code. And it's necessary to configure it for Visual Studio options without .net dependecy. It must work.

    I don't know how it works for new versions of ovaldi.

    Thank you.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks