자격 증명 공급자의 명명 된 파이프를 통해 Windows 서비스와 통신하려고하지만 COM 인터페이스의 구조 내에 명명 된 파이프 코드를 어디에 둘 것인지 잘 모르겠습니다. 내가 테스트 베드로서 (Microsoft에서) SampleHardwareEventCredentialProvider를 사용하고, 나는 CSampleCredential.cpp 내에서 다음 코드 생성 : 내가 잘못 자리에 여부를 배치하고있어하지 않는 한,자격 증명 공급자 및 명명 된 파이프
// Initializes one credential with the field information passed in.
// Set the value of the SFI_USERNAME field to pwzUsername.
HRESULT CSampleCredential::Initialize(
CREDENTIAL_PROVIDER_USAGE_SCENARIO cpus,
const CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR* rgcpfd,
const FIELD_STATE_PAIR* rgfsp
)
{
HRESULT hr = S_OK;
_cpus = cpus;
// Copy the field descriptors for each field. This is useful if you want to vary the field
// descriptors based on what Usage scenario the credential was created for.
for (DWORD i = 0; SUCCEEDED(hr) && i < ARRAYSIZE(_rgCredProvFieldDescriptors); i++)
{
_rgFieldStatePairs[i] = rgfsp[i];
hr = FieldDescriptorCopy(rgcpfd[i], &_rgCredProvFieldDescriptors[i]);
}
// Initialize named pipe
if (SUCCEEDED(hr)) {
HANDLE pipe = CreateNamedPipe("\\\\.\\pipe\\PipeData", PIPE_ACCESS_INBOUND | PIPE_ACCESS_OUTBOUND, PIPE_WAIT, 1, 1024, 1024, 120 * 1000, NULL);
if (pipe == INVALID_HANDLE_VALUE)
{
cout << "Error: " << GetLastError();
}
char data[1024];
DWORD numRead;
ConnectNamedPipe(pipe, NULL);
ReadFile(pipe, data, 1024, &numRead, NULL);
}
이 분명히 작동하지 않습니다 Windows 서비스에서 들어오는 메시지를 수신 대기하도록 CP를 초기화 하시겠습니까? 어떻게하면 좋을까요?