Hi, I just have a problem: I don't know how to read a "LargeInteger" in a VARIANT coming from AD object (user) property. As my purpose, I want to get the information of lastLogonTimestamp instead the lastLogon (this can be read by get_LastLogin() easily).
My code below:
HRESULT hr7;
VARIANT var_lastlogon_timestamp;
SYSTEMTIME lastlogon_timestamp_st;
hr7=p_user->lpVtbl->Get(p_user,L"lastLogonTimestamp",&var_lastlogon_timestamp);
if(hr7==S_OK){
//LONGLONG ll=131406647934745516; // This is the actual value in the system showing in AD user tool
LONGLONG ll;
ll=V_I8(&var_lastlogon_timestamp);
memset((void *)&lastlogon_timestamp_st,0,sizeof(SYSTEMTIME));
FileTimeToSystemTime((FILETIME *)&ll,&lastlogon_timestamp_st);
sprintf(date_text,"Last logon timestamp:\t\t%04d-%02d-%02d\n",lastlogon_timestamp_st.wYear,lastlogon_timestamp_st.wMonth,lastlogon_timestamp_st.wDay);
strcat(output_user,date_text);
VariantClear(&var_lastlogon_timestamp);
}
I think I misunderstand the complicated struct VARIANT and wrongly use V_I8(). And the official example code confuses me too:
https://msdn.microsoft.com/en-us/library/aa705925(v=vs.85).aspxI also try to set breakpoint and see the runtime value, but it's too complex to get the actual value directly. If the property value type is string or date, it's easy for me to get it...
Anybody have such experience to show me the correct and simply way?