2009-06-15 4 views
0

Java 서블릿을 통해 Windows 사용자를 인증 할 수있는 방법은 여기에있는 C++ 멍청한 놈입니다.LogonUser를 사용하여 JNI 인증 사용자에게 전화 하시겠습니까?

D:\JNI\Validate.cpp(21) : error C2065: 'handle' : undeclared identifier 
D:\JNI\Validate.cpp(21) : error C2146: syntax error : missing ';' before 
ier 'hToken' 
D:\JNI\Validate.cpp(21) : error C2065: 'hToken' : undeclared identifier 
D:\JNI\Validate.cpp(24) : error C2065: 'LOGON32_LOGON_NETWORK' : undeclar 
tifier 
D:\JNI\Validate.cpp(24) : error C2065: 'LOGON32_PROVIDER_DEFAULT' : undec 
dentifier 
D:\JNI\Validate.cpp(24) : error C3861: 'LogonUser': identifier not found 
: 컴파일 할 때

#include <stdio.h> 
#include <string.h> 
#include <sys/stat.h> 
#include <stdlib.h> 

#include "Validate.h"  

JNIEXPORT jstring JNICALL Java_Validate_takeInfo(JNIEnv *env, jobject obj, jstring domain, jstring id, jstring idca, jstring password) 
{ 
    const char *nt_domain; 
    const char *nt_id; 
    const char *nt_idca; 
    const char *nt_password; 

    nt_domain = env->GetStringUTFChars(domain, NULL); 
    nt_id = env->GetStringUTFChars(id, NULL); 
    nt_idca= env->GetStringUTFChars(idca, NULL); 
    nt_password = env->GetStringUTFChars(password, NULL); 

    handle hToken = 0; 
    char *otherString; 
    otherString = LogonUser(nt_id, nt_domain, nt_password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &hToken); 

    jstring newString = env->NewStringUTF((const char*)otherString); 
    return newString; 
} 

나는 이러한 오류를 얻을 : 여기

내가 사용자의 사용자 이름 도메인 및 암호를 사용하여 내 자바 서블릿에서 JNI 호출에 걸릴 함께 넣어 가지고 코드입니다

내가 필요한 것을 포함하고 있지 않다고 가정합니다. 어떤 도움이라도 대단히 감사합니다.

답변

0

컴파일러가 LogonUser를 찾을 수 없다는 것은 Windows 헤더가 누락되었다고 암시합니다. 포함 windows.h

또한 일반 창 핸들 유형의 철자가 모두 대문자입니다.

자세한 내용은 the LogonUser docs을 참조하십시오.

관련 문제