locked
NPS extension DLL problem RRS feed

  • Question

  • Hi. I'm trying to write my own NPS extension DLL on MS VS Ultimate 2010 32bit

    This is the code of the DLL:

    #include <Windows.h>
    #include <Authif.h>

    #define DLLEXPORT extern "C" __declspec(dllexport)

    DLLEXPORT DWORD WINAPI RadiusExtensionProcess2(__in const RADIUS_ATTRIBUTE *pAttrs,__out PRADIUS_ACTION pfAction)
    {
    return NO_ERROR;
    }
    DLLEXPORT DWORD WINAPI RadiusExtensionInit(void)
    {
    return NO_ERROR;
    }

    bool APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
    {
    return TRUE;
    }



    But, when NPS is trying to load this library(I've set the path to the dll in the registry), there is an error: "Extension host failed to load extension DLL. Path: C:\New\extention.dll. Error: 0x1c"



    As I've understood, library must have been loaded, due to it's simplicity, and rule-export "RadiusExtensionProcess2" function. But there is an error, and NPS can not be started. NPS is running on win server 08 R2 64bit.
    When we use 32bit dll, we have 0xc1 error.(not valid win32 application)
    When we use 64bit dll, we have 0x7e error.(The specified module could not be found)

    Would you show me the simplest DLL code, which NPS is able to load without any error
    or tell us which module to use?

    THx.
    Reply With Quote
    Thursday, December 2, 2010 12:18 PM

Answers

All replies

  • Hi. I'm trying to write my own NPS extension DLL on MS VS Ultimate 2010 32bit

    This is the code of the DLL:

    #include <Windows.h>
    #include <Authif.h>

    #define DLLEXPORT extern "C" __declspec(dllexport)

    DLLEXPORT DWORD WINAPI RadiusExtensionProcess2(__in  const RADIUS_ATTRIBUTE *pAttrs,__out  PRADIUS_ACTION pfAction)
    {
        return NO_ERROR;
    }
    DLLEXPORT DWORD WINAPI RadiusExtensionInit(void)
    {
        return NO_ERROR;
    }

    bool APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
    {
       return TRUE;
    }

     

    But, when NPS is trying to load this library(I've set the path to the dll in the registry), there is an error: "Extension host failed to load extension DLL. Path: C:\New\extention.dll. Error: 0x5"

     

    As I've understood, library must have been loaded, due to it's simplicity, and rule-export "RadiusExtensionProcess2" function. But there is an error, and NPS can not be started. NPS is running on win server 08 R2 64bit.

    Would you show me the simplest DLL code, which NPS is able to load without any error.

    THx.

     

    Monday, November 29, 2010 2:41 PM
  • Hi,

     

    Thanks for posting here.

     

     

    For the development of NPS extension, it is recommend you to get further support in the MSDN Forum so that you can get the most qualified pool of respondents.

     

    http://social.msdn.microsoft.com/Forums/en-us/categories/

     

    For more information ,you may refer to the article below:

     

    Network Policy Server Extensions

    http://msdn.microsoft.com/en-us/library/bb891989(v=VS.85).aspx

     

    Thanks

     

    Tiger Li


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Tuesday, November 30, 2010 6:45 AM
  • Hi guys,

    I am also writing an extension dll in Visual Studio 2010 Ultimate (on Windows 7 Ultimate) for NPS server on Windows Server 2008 R2.

    This is the code of the dll.

    #include "stdafx.h"
    #include "resource.h"
    #include "comradiusv0_i.h"
    #include "dllmain.h"
    #include <Windows.h>
    #include <Authif.h>
    #define DLLEXPORT extern "C" __declspec(dllexport)

    Ccomradiusv0Module _AtlModule;
    // DLL Entry Point
    extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
    {
        return TRUE;
    }
    DWORD WINAPI RadiusExtensionInit(void)
    {
        return NO_ERROR;
    }
    DWORD WINAPI RadiusExtensionProcess2(_Inout_  PRADIUS_EXTENSION_CONTROL_BLOCK pECB)
    {
        return NO_ERROR;
    }

    This dll is build successfully and its is being registered successfully by regsvr command utility and also manually in the specified location "HKLM\System\CurrentControlSet\Services\AuthSrv\Parameters\" as per MSDN ( http://msdn.microsoft.com/en-us/library/windows/desktop/bb892024%28v=vs.85%29.aspx ).
    After that when we restart the NPS server; the following error is generated.

    Extension host failed to load extension DLL. Path: C:\New\comradiusv0.dll. Error: 0xc1.

    Please help out to resolve this error. Thanks

    Thursday, March 14, 2013 5:17 AM