views:

149

answers:

2

I have wrote a user manager script the uses NTLMSetUserInfo to set passwords of some users, including ADMIN... What I have noticed though is that if I do this the username / password combination works perfectly for all scenarios such as Telnet, HTTP Auth etc but NOT file browsing.

Upon further inspection I noticed that when setting the Admin password through the built in CE configuration web pages it works.

The registry for Admin looks like so when I use NTLMSetUserInfo

NT = [hex value]

The registry for Admin contains an extra field, Password when I set the admin password via the CE web pages.

NT = [hex value]
Password = [hex value]

I figure NTLMSetUserInfo doesn't set the global CE password for Admin properly, hence not being able to file browse onto the box.

I found the following function in the CE web code parsing DLL that does the job called SetPassword. I wrote a separate function to deal with Admin cases but I cannot get it to compile. Here is a snippet of it

#include <windbase.h>

bool UserAccounts::SetAdminPassword(const std::string &passwordOld, const std::string &password)
{
    wchar_t wpass[512];
    wchar_t wpassold[512];

    mbstowcs(wpass, password.c_str(), 512);
    mbstowcs(wpassold, passwordOld.c_str(), 512);

    return SetPassword(wpassold, wpass) == TRUE;
}

This will not compile stating that 'SetPassword': identifier not found. I notice in the CE documentation for SetPassword it has the following line

To use this function, you must include the password component, Fspass, in your Cesysgen.bat file.

I'm not sure what this means as I am pretty new to PlatformBuilder etc...

Can anyone help me or point me in the right direction?

A: 

I can't give an exact answer right now (never used this authentication). But, I just tried to use (actually compile) SetPassword in a cloned version of the bluetooth AudioGateway driver I have and it compiles without problems.

When I tried to use it in a subproject or a regular independent project I had the same error that you got. So a quick solution might be to do this in a driver and see if it works.

Regarding the comment in the docs I assume they it goes down to having the SYSGEN_FSPASSWORD selected in the catalog though I did not trace this yet. I guess you have this selected if you can set passwords and such.

Shaihi
@Shaihi. Thanks for the response. Our SDK has SYSGEN_FSPASSWORD compiled in so can't imagine that component isn't part of the SDK. Do you know what LIB it is part of so I can link to it?
Chris
I just added it to a regular driver and it compiled as well. I guess it resides in `coredll`. I searched for the function name in the `coredll.dll` in the release directory and it shows there. Did you try to add the call to a driver?
Shaihi
A: 

Add the following to the top of your code file:

extern "C" BOOL SetPassword(LPWSTR lpszOldPassword, LPWSTR lpszNewPassword);

The linker will do the rest.

ctacke
Doh! You think this is the problem? I should have thought of that...
Shaihi
Yeah, it's the shortcut when you can't find the header. I tend to do this a lot for functions I know are there, but I can't find the declaration (TouchCalibrate, SetPassword, etc).
ctacke