EDIT: I know how to create byte array in jni but here i want to convert the CComsafeArray to the byte array.! And the byte array contains a hexadeciamal values. I wrote a native function which has the byte array which is a info of a image.I want to send this byte array to java using jni. Where i can convert the byte array to image there.
{
IADsUser* pUser;
CoInitialize(NULL);
CComBSTR path = L"LDAP://WIN-F94H2MP3UJR.Test.local/CN=Someone,CN=Users";
path += L",DC=Test,DC=local";
HRESULT hr = ADsOpenObject(path, L"Administrator", L"pass@12",
ADS_SECURE_AUTHENTICATION, // For secure authentication
IID_IADsUser,
(void**)&pUser);
if (FAILED(hr)) { return NULL; }
VARIANT var;
hr = pUser->get_Picture(&var);
if (SUCCEEDED(hr)) {
SAFEARRAY* d = var.parray;
CComSafeArray<BYTE> sa(d);
const LONG lb = sa.GetLowerBound();
const LONG ub = sa.GetUpperBound();
VARTYPE dataTypeStored = sa.GetType(); // Returns 17 which is the type for bytes.
}
return hr;
}
the sa is the byte array which i have to pass to java. I Researched a lot and couldn't found any. Any help will be useful.