Ejemplo n.º 1
0
JNIEXPORT void JNICALL Java_jmtp_PortableDeviceContentImplWin32_delete
	(JNIEnv* env, jobject obj, jint jiOptions, jobject jobjObjectIDs)
{
	//variabelen
	HRESULT hr;
	IPortableDeviceContent* pDeviceContent;
	IPortableDevicePropVariantCollection* pObjectIDs;
	

	//Methode implementatie
	if(jiOptions == 0 || jiOptions == 1)
	{
		pDeviceContent = GetPortableDeviceContent(env, obj);
		pObjectIDs = (IPortableDevicePropVariantCollection*)GetComReferencePointerFromComReferenceable(env, jobjObjectIDs);
		hr = pDeviceContent->Delete(jiOptions, pObjectIDs, NULL);

		if(FAILED(hr))
		{
			ThrowCOMException(env, L"Failed to delete the files", hr);
			return;
		}
	}
	else
	{
		env->ThrowNew(env->FindClass("java/lang/IllegalArgumentException"), "The parameter options has an invalid value.");
		return;
	}
}