|
Packit |
fc043f |
/* gen-w32-lock-obj.c - Build tool to get the size of the lock object.
|
|
Packit |
fc043f |
Copyright (C) 2014 g10 Code GmbH
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
This file is part of libgpg-error.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
libgpg-error is free software; you can redistribute it and/or
|
|
Packit |
fc043f |
modify it under the terms of the GNU Lesser General Public License
|
|
Packit |
fc043f |
as published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
fc043f |
the License, or (at your option) any later version.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
libgpg-error is distributed in the hope that it will be useful, but
|
|
Packit |
fc043f |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
fc043f |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
fc043f |
Lesser General Public License for more details.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
fc043f |
License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
Packit |
fc043f |
*/
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
#if HAVE_CONFIG_H
|
|
Packit |
fc043f |
#include <config.h>
|
|
Packit |
fc043f |
#endif
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
#ifndef HAVE_W32_SYSTEM
|
|
Packit |
fc043f |
# error This module may only be build for Windows.
|
|
Packit |
fc043f |
#endif
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
#include <stdlib.h>
|
|
Packit |
fc043f |
#include <stdio.h>
|
|
Packit |
fc043f |
#include <windows.h>
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
#include "w32-lock-obj.h"
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
int
|
|
Packit |
fc043f |
main (void)
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
_gpgrt_lock_t lk;
|
|
Packit |
fc043f |
unsigned char *p;
|
|
Packit |
fc043f |
int i;
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
printf ("sizeof CRITICAL_SECTION = %u\n", (int)sizeof (CRITICAL_SECTION));
|
|
Packit |
fc043f |
printf ("sizeof _gpgrt_lock_t = %u\n", (int)sizeof lk);
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
memset (&lk, 0, sizeof lk);
|
|
Packit |
fc043f |
lk.vers = LOCK_ABI_VERSION;
|
|
Packit |
fc043f |
lk.started = -1;
|
|
Packit |
fc043f |
printf ("#define GPGRT_LOCK_INITIALIZER {");
|
|
Packit |
fc043f |
p = (unsigned char *)&lk;
|
|
Packit |
fc043f |
for (i=0; i < sizeof lk - 1; i++)
|
|
Packit |
fc043f |
printf ("%u,", p[i]);
|
|
Packit |
fc043f |
printf ("%u}\n", p[sizeof(lk)-1]);
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
return 0;
|
|
Packit |
fc043f |
}
|