48#define X(f) p##f = (void*)GetProcAddress(hKernel32, #f);
67 "FlsData expected not to be changed, value is %p, expected %p\n",
74 BYTE *tparam = (
BYTE *)lpFiberParameter;
76 ok(*tparam == 185,
"Parameterdata expected not to be changed\n");
83 ok(
ret ==
NULL,
"FlsGetValue returned %p, expected NULL\n",
ret);
100 if (pConvertThreadToFiber)
107 win_skip(
"ConvertThreadToFiber not present\n" );
113 if (pConvertThreadToFiberEx)
120 win_skip(
"ConvertThreadToFiberEx not present\n" );
126 if (pConvertFiberToThread)
128 BOOL ret = pConvertFiberToThread();
133 win_skip(
"ConvertFiberToThread not present\n" );
146 if (pConvertThreadToFiberEx)
154 pSwitchToFiber(
fibers[1]);
163 pSwitchToFiber(
fibers[1]);
167 else win_skip(
"CreateFiberEx not present\n" );
169 if (pIsThreadAFiber)
ok(pIsThreadAFiber(),
"IsThreadAFiber reported FALSE\n");
171 if (pIsThreadAFiber)
ok(!pIsThreadAFiber(),
"IsThreadAFiber reported TRUE\n");
180 if (!pFlsAlloc || !pFlsSetValue || !pFlsGetValue || !pFlsFree)
182 win_skip(
"Fiber Local Storage not supported\n" );
191 ret = pFlsFree( 127 );
192 ok( !
ret,
"freeing fls index 127 (unallocated) succeeded\n" );
194 "freeing fls index 127 (unallocated) wrong error %u\n",
GetLastError() );
196 val = pFlsGetValue( 127 );
198 "getting fls index 127 (unallocated) failed with error %u\n",
GetLastError() );
200 ret = pFlsSetValue( 127, (
void*) 0x217 );
201 ok(
ret,
"setting fls index 127 (unallocated) failed with error %u\n",
GetLastError() );
204 val = pFlsGetValue( 127 );
205 ok(
val == (
void*) 0x217,
"fls index 127 (unallocated) wrong value %p\n",
val );
207 "getting fls index 127 (unallocated) failed with error %u\n",
GetLastError() );
213 ret = pFlsFree( 128 );
214 ok( !
ret,
"freeing fls index 128 (out of bounds) succeeded\n" );
216 "freeing fls index 128 (out of bounds) wrong error %u\n",
GetLastError() );
219 ret = pFlsSetValue( 128, (
void*) 0x217 );
220 ok( !
ret,
"setting fls index 128 (out of bounds) succeeded\n" );
222 "setting fls index 128 (out of bounds) wrong error %u\n",
GetLastError() );
225 val = pFlsGetValue( 128 );
227 "getting fls index 128 (out of bounds) wrong error %u\n",
GetLastError() );
231 val = pFlsGetValue( 0 );
232 ok( !
val,
"fls index 0 set to %p\n",
val );
235 ret = pFlsSetValue( 0, (
void *)0xdeadbeef );
236 ok( !
ret,
"setting fls index 0 succeeded\n" );
239 val = pFlsGetValue( 0 );
240 ok( !
val,
"fls index 0 wrong value %p\n",
val );
246 ok(
fls != 0,
"fls index 0 allocated\n" );
247 val = pFlsGetValue(
fls );
248 ok( !
val,
"fls index %u wrong value %p\n",
fls,
val );
249 ret = pFlsSetValue(
fls, (
void *)0xdeadbeef );
250 ok(
ret,
"setting fls index %u failed\n",
fls );
252 val = pFlsGetValue(
fls );
253 ok(
val == (
void *)0xdeadbeef,
"fls index %u wrong value %p\n",
fls,
val );
260 val = pFlsGetValue(
fls );
266 ret = pFlsSetValue(
fls, (
void *)0xdeadbabe );
267 ok(
ret,
"setting fls index %u failed\n",
fls );
268 val = pFlsGetValue(
fls );
269 ok(
val == (
void *)0xdeadbabe,
"fls index %u wrong value %p\n",
fls,
val );
272 fls_2 = pFlsAlloc(
NULL );
275 ok( fls_2 ==
fls,
"different FLS index allocated, was %u, now %u\n",
fls, fls_2 );
278 val = pFlsGetValue( fls_2 );
281 "getting fls index %u failed with error %u\n", fls_2,
GetLastError() );
291 if (!pFlsAlloc || !pFlsSetValue || !pFlsGetValue || !pFlsFree)
293 win_skip(
"Fiber Local Storage not supported\n" );
299 fls = pFlsAlloc( cbfunc );
302 val = (
void*) 0x1587;
307 val2 = pFlsGetValue(
fls );
308 ok(
val == val2,
"FlsGetValue returned %p, expected %p\n", val2,
val);
316 fls = pFlsAlloc( cbfunc );
329 void* val1 = (
void*) 0x314;
330 void* val2 = (
void*) 0x152;
333 if (!pFlsAlloc || !pFlsFree || !pFlsSetValue || !pFlsGetValue)
335 win_skip(
"Fiber Local Storage not supported\n" );
356 pSwitchToFiber(
fibers[1]);
363 pSwitchToFiber(
fibers[2]);
369 ok(
ret,
"FlsSetValue failed\n");
402 win_skip(
"Fibers not supported by win95\n" );
#define ERROR_INVALID_PARAMETER
LPVOID WINAPI ConvertThreadToFiberEx(_In_opt_ LPVOID lpParameter, _In_ DWORD dwFlags)
BOOL WINAPI ConvertFiberToThread(VOID)
LPVOID WINAPI CreateFiberEx(_In_ SIZE_T dwStackCommitSize, _In_ SIZE_T dwStackReserveSize, _In_ DWORD dwFlags, _In_ LPFIBER_START_ROUTINE lpStartAddress, _In_opt_ LPVOID lpParameter)
VOID WINAPI DeleteFiber(_In_ LPVOID lpFiber)
BOOL WINAPI IsThreadAFiber(VOID)
PVOID WINAPI FlsGetValue(DWORD dwFlsIndex)
BOOL WINAPI FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData)
LPVOID WINAPI ConvertThreadToFiber(_In_opt_ LPVOID lpParameter)
BOOL WINAPI FlsFree(DWORD dwFlsIndex)
DWORD WINAPI FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback)
LPVOID WINAPI CreateFiber(_In_ SIZE_T dwStackSize, _In_ LPFIBER_START_ROUTINE lpStartAddress, _In_opt_ LPVOID lpParameter)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
static LPFIBER_START_ROUTINE
static DWORD fls_index_to_set
static void test_ConvertThreadToFiberEx(void)
static void test_ConvertFiberToThread(void)
static void * fls_value_to_set
static void test_FiberLocalStorageWithFibers(PFLS_CALLBACK_FUNCTION cbfunc)
static void test_ConvertThreadToFiber(void)
static VOID init_funcs(void)
static void test_FiberHandling(void)
static void test_FiberLocalStorageCallback(PFLS_CALLBACK_FUNCTION cbfunc)
static void test_FiberLocalStorage(void)
static VOID WINAPI FiberLocalStorageProc(PVOID lpFlsData)
static VOID WINAPI FiberMainProc(LPVOID lpFiberParameter)
DWORD WINAPI GetLastError(void)
#define FLS_OUT_OF_INDEXES
VOID(WINAPI * PFLS_CALLBACK_FUNCTION)(PVOID)
void WINAPI SwitchToFiber(_In_ PVOID)