widl: Add support for function parameter flags to SLTG typelib generator.
[wine.git] / dlls / ktmw32 / ktmw32_main.c
blobaf9db28530fd3adcbcff130ce4b8d51a8b3b3e4e
1 /*
2 * Copyright 2010 Vincent Povirk for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winternl.h"
27 static inline BOOL set_ntstatus( NTSTATUS status )
29 if (status) RtlSetLastWin32Error( RtlNtStatusToDosError( status ));
30 return !status;
33 static inline LARGE_INTEGER *get_nt_timeout( LARGE_INTEGER *time, DWORD timeout )
35 if (timeout == INFINITE) return NULL;
36 time->QuadPart = (ULONGLONG)timeout * -10000;
37 return time;
40 /***********************************************************************
41 * CommitTransaction (ktmw32.@)
43 BOOL WINAPI CommitTransaction(HANDLE transaction)
45 return set_ntstatus( NtCommitTransaction( transaction, TRUE ));
48 /***********************************************************************
49 * CreateTransaction (ktmw32.@)
51 HANDLE WINAPI CreateTransaction( SECURITY_ATTRIBUTES *sa, GUID *guid, DWORD options, DWORD level, DWORD flags,
52 DWORD timeout, WCHAR *desc )
54 ULONG obj_flags = OBJ_CASE_INSENSITIVE;
55 UNICODE_STRING desc_str;
56 OBJECT_ATTRIBUTES attr;
57 LARGE_INTEGER time;
58 HANDLE handle;
60 if (sa && sa->bInheritHandle) obj_flags |= OBJ_INHERIT;
61 InitializeObjectAttributes( &attr, NULL, obj_flags, 0, sa ? sa->lpSecurityDescriptor : NULL );
63 RtlInitUnicodeString( &desc_str, desc );
65 if (!set_ntstatus( NtCreateTransaction( &handle, 0 /* FIXME */, &attr, guid, NULL, options, level, flags,
66 get_nt_timeout( &time, timeout ), &desc_str )))
68 return INVALID_HANDLE_VALUE;
71 return handle;
74 /***********************************************************************
75 * RollbackTransaction (ktmw32.@)
77 BOOL WINAPI RollbackTransaction(HANDLE transaction)
79 return set_ntstatus( NtRollbackTransaction( transaction, TRUE ));