diff options
| author | Kevin Koch <kpkoch@mit.edu> | 2008-02-19 15:22:13 +0000 |
|---|---|---|
| committer | Kevin Koch <kpkoch@mit.edu> | 2008-02-19 15:22:13 +0000 |
| commit | 1ad7c24419422ce0d62c80699eb4cd30b1c3d51b (patch) | |
| tree | a8d853bff3d5101093ed37a2a9cf8f3fbc8628fb /src/ccapi/common/win | |
| parent | c90fb4c40ec4fb78e4d1b2a40c9c5af36225603c (diff) | |
| download | krb5-1ad7c24419422ce0d62c80699eb4cd30b1c3d51b.tar.gz krb5-1ad7c24419422ce0d62c80699eb4cd30b1c3d51b.tar.xz krb5-1ad7c24419422ce0d62c80699eb4cd30b1c3d51b.zip | |
Changes to integrate the CCAPI build into the build structure, build the test suite and fixes to random problems discovered along the way
Since no platform other than windows builds CCAPI using the build system, some conditionalizing may be necessary when other platforms use the makefiles.
src/Makefile.in: Add CPPFLAGS that seemed to be missing; run wconfig for ccapi/(lib, server, test).
config/win-pre.in: DEBUGOPT /ZI doesn't seem to provide enough debugging information under VS2005; /Zi does.
windows/build/bkw.pl: Fix -no<switch> so that -nonodebug will work. Otherwise, can't do debug build.
Move Get/PutTspData out of dllmain; add tlsindex argument.
Comment out some debug messages.
TargetVersion: 1.7
Component: krb5-libs
Ticket: 5594
Tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20229 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/common/win')
| -rw-r--r-- | src/ccapi/common/win/OldCC/ccutils.c | 2 | ||||
| -rw-r--r-- | src/ccapi/common/win/OldCC/util.cxx | 7 | ||||
| -rw-r--r-- | src/ccapi/common/win/tls.c | 47 | ||||
| -rw-r--r-- | src/ccapi/common/win/tls.h | 7 | ||||
| -rw-r--r-- | src/ccapi/common/win/win-utils.c | 3 |
5 files changed, 55 insertions, 11 deletions
diff --git a/src/ccapi/common/win/OldCC/ccutils.c b/src/ccapi/common/win/OldCC/ccutils.c index bfe138997..d1b39cc38 100644 --- a/src/ccapi/common/win/OldCC/ccutils.c +++ b/src/ccapi/common/win/OldCC/ccutils.c @@ -25,6 +25,8 @@ */ #include <windows.h> +#include <stdlib.h> +#include <malloc.h> #include "cci_debugging.h" #include "util.h" diff --git a/src/ccapi/common/win/OldCC/util.cxx b/src/ccapi/common/win/OldCC/util.cxx index 8694c373c..dd4a2694a 100644 --- a/src/ccapi/common/win/OldCC/util.cxx +++ b/src/ccapi/common/win/OldCC/util.cxx @@ -26,15 +26,16 @@ #include <windows.h> #include <stdio.h> // for _snprintf - -#include "util.h" -#include "secure.hxx" +#include <malloc.h> +#include <stdlib.h> extern "C" { #include "cci_debugging.h" #include "ccutils.h" } +#include "util.h" +#include "secure.hxx" void* malloc_alloc_p(size_t size) { diff --git a/src/ccapi/common/win/tls.c b/src/ccapi/common/win/tls.c index cf8daa3b2..45020b570 100644 --- a/src/ccapi/common/win/tls.c +++ b/src/ccapi/common/win/tls.c @@ -25,6 +25,8 @@ */ #include "string.h" +#include <stdlib.h> +#include <malloc.h> #include "tls.h" @@ -58,14 +60,47 @@ void tspdata_setSST (struct tspdata* p, time_t t) {p->_sst void tspdata_setStream (struct tspdata* p, cci_stream_t s) {p->_stream = s;} -BOOL tspdata_getConnected (struct tspdata* p) {return p->_CCAPI_Connected;} +BOOL tspdata_getConnected (const struct tspdata* p) {return p->_CCAPI_Connected;} -HANDLE tspdata_getReplyEvent(struct tspdata* p) {return p->_replyEvent;} +HANDLE tspdata_getReplyEvent(const struct tspdata* p) {return p->_replyEvent;} -time_t tspdata_getSST (const struct tspdata* p) {return p->_sst;} +time_t tspdata_getSST (const struct tspdata* p) {return p->_sst;} -cci_stream_t tspdata_getStream (const struct tspdata* p) {return p->_stream;} +cci_stream_t tspdata_getStream (const struct tspdata* p) {return p->_stream;} + +char* tspdata_getUUID (const struct tspdata* p) {return p->_uuid;} + +RPC_ASYNC_STATE* tspdata_getRpcAState (const struct tspdata* p) {return p->_rpcState;} + +BOOL WINAPI PutTspData(DWORD dwTlsIndex, struct tspdata* dw) { + LPVOID lpvData; + struct tspdata** pData; // The stored memory pointer + + // Retrieve a data pointer for the current thread: + lpvData = TlsGetValue(dwTlsIndex); + + // If NULL, allocate memory for the TLS slot for this thread: + if (lpvData == NULL) { + lpvData = (LPVOID) LocalAlloc(LPTR, sizeof(struct tspdata)); + if (lpvData == NULL) return FALSE; + if (!TlsSetValue(dwTlsIndex, lpvData)) return FALSE; + } + + pData = (struct tspdata**) lpvData; // Cast to my data type. + // In this example, it is only a pointer to a DWORD + // but it can be a structure pointer to contain more complicated data. + + (*pData) = dw; + return TRUE; + } + +BOOL WINAPI GetTspData(DWORD dwTlsIndex, struct tspdata** pdw) { + struct tspdata* pData; // The stored memory pointer + + pData = (struct tspdata*)TlsGetValue(dwTlsIndex); + if (pData == NULL) return FALSE; + (*pdw) = pData; + return TRUE; + } -char* tspdata_getUUID (const struct tspdata* p) {return p->_uuid;} -RPC_ASYNC_STATE* tspdata_getRpcAState (const struct tspdata* p) {return p->_rpcState;} diff --git a/src/ccapi/common/win/tls.h b/src/ccapi/common/win/tls.h index 3d988cd69..1a6086888 100644 --- a/src/ccapi/common/win/tls.h +++ b/src/ccapi/common/win/tls.h @@ -31,13 +31,14 @@ #include "windows.h" #include "time.h" +#include "rpc.h" #include "cci_stream.h" #define UUID_SIZE 128 -/* The client code can be run in any client thread. The thread-specific data - is defined here. +/* The client code can be run in any client thread. + The thread-specific data is defined here. */ struct tspdata { @@ -66,5 +67,7 @@ time_t tspdata_getSST (const struct tspdata* p); cci_stream_t tspdata_getStream (const struct tspdata* p); char* tspdata_getUUID (const struct tspdata* p); +BOOL WINAPI PutTspData(DWORD tlsIndex, struct tspdata* dw); +BOOL WINAPI GetTspData(DWORD tlsIndex, struct tspdata** pdw); #endif _tls_h diff --git a/src/ccapi/common/win/win-utils.c b/src/ccapi/common/win/win-utils.c index 4cba153a9..f60ee3b8f 100644 --- a/src/ccapi/common/win/win-utils.c +++ b/src/ccapi/common/win/win-utils.c @@ -28,6 +28,9 @@ #include <string.h> #include <time.h> #include "windows.h" +#include <stdlib.h> +#include <malloc.h> + #include "win-utils.h" #include "cci_debugging.h" |
