Beispiel #1
0
Uri *
Uri::Create (const char *uri_string, UriKind uri_kind)
{
	GCHandle gchandle;

	gchandle = GCHandle (Deployment::GetCurrent ()->GetUriFunctions ()->ctor_2 (uri_string, uri_kind));

	return !gchandle.IsAllocated () ? NULL : new Uri (gchandle);
}
Beispiel #2
0
SQLBRIDGE_API void end_tran(long long m_handle)
{
	IntPtr^ pointer = gcnew IntPtr(m_handle);
	GCHandle handle = GCHandle::FromIntPtr(*pointer);
	SqlTransaction^ tran = safe_cast<SqlTransaction^>(handle.Target);
	tran->Commit();
	//释放句柄
	handle.Free();
}
Beispiel #3
0
Uri *
Uri::Create (const char *uri_string)
{
	GCHandle gchandle;

	gchandle = Deployment::GetCurrent ()->GetUriFunctions ()->ctor_2 (uri_string, UriKindRelativeOrAbsolute);

	return !gchandle.IsAllocated () ? NULL : new Uri (gchandle);
}
Beispiel #4
0
Uri *
Uri::Create (const Uri *base_uri, const Uri *relative_uri)
{
	GCHandle gchandle;

	gchandle = GCHandle (Deployment::GetCurrent ()->GetUriFunctions ()->ctor_4 (base_uri->GetGCHandle ().ToIntPtr (), relative_uri->GetGCHandle ().ToIntPtr ()));

	return !gchandle.IsAllocated () ? NULL : new Uri (gchandle);
}
Beispiel #5
0
Uri *
Uri::CloneWithScheme (const Uri *uri_to_clone, const char *scheme)
{
	GCHandle gchandle;

	if (uri_to_clone != NULL && uri_to_clone->GetGCHandle ().IsAllocated ())
		gchandle = GCHandle (uri_to_clone->deployment->GetUriFunctions ()->clone_with_scheme (uri_to_clone->GetGCHandle ().ToIntPtr (), scheme));

	return gchandle.IsAllocated () ? new Uri (gchandle) : NULL;
}
Beispiel #6
0
Uri *
Uri::Clone (const Uri *uri_to_clone)
{
	GCHandle gchandle;

	if (uri_to_clone != NULL && uri_to_clone->GetGCHandle ().IsAllocated ())
		gchandle = uri_to_clone->deployment->CloneGCHandle (uri_to_clone->GetGCHandle ());

	return gchandle.IsAllocated () ? new Uri (gchandle) : NULL;
}
Beispiel #7
0
// ---------------------------------------------------------------
_DLLAPI void __stdcall DestroyManagedObject(long long hObject, 
											wchar_t* exType, 
											wchar_t* exMessage)
{
	if (hObject <= 0 
		|| exType == NULL 
		|| exMessage == NULL) return;

	try
	{
		GCHandle handle = GCHandle::FromIntPtr(IntPtr((HANDLE)hObject));
		handle.Free();
	}
	catch (Exception^ ex)
	{
		IntPtr exT = Marshal::StringToHGlobalUni(ex->GetType()->Name);
		wcsncpy(exType, (const wchar_t*)exT.ToPointer(), 64);
		Marshal::FreeHGlobal(exT);

		IntPtr exM = Marshal::StringToHGlobalUni(ex->Message);
		wcsncpy(exMessage, (const wchar_t*)exM.ToPointer(), 256);
		Marshal::FreeHGlobal(exM);
	}
}