2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
19 * REALLOC ____________________________________________________________________
23 BOOL AfsCredsReallocFunction (LPVOID *ppTarget, size_t cbElement, size_t *pcTarget, size_t cReq, size_t cInc)
28 if (cReq <= *pcTarget)
31 if ((cNew = cInc * ((cReq + cInc-1) / cInc)) <= 0)
34 if ((pNew = Allocate (cbElement * cNew)) == NULL)
36 memset (pNew, 0x00, cbElement * cNew);
40 memcpy (pNew, *ppTarget, cbElement * (*pcTarget));
51 * REGISTRY SETTINGS __________________________________________________________
55 void LoadRemind (size_t iCreds)
57 g.aCreds[ iCreds ].fRemind = TRUE;
60 if (RegOpenKey (REGSTR_BASE, REGSTR_PATH_AFSCREDS, &hk) == 0)
63 DWORD dwSize = sizeof(dwValue);
64 DWORD dwType = REG_DWORD;
65 if (RegQueryValueEx (hk, g.aCreds[ iCreds ].szCell, NULL, &dwType, (PBYTE)&dwValue, &dwSize) == 0)
66 g.aCreds[ iCreds ].fRemind = dwValue;
72 void SaveRemind (size_t iCreds)
75 if (RegCreateKey (REGSTR_BASE, REGSTR_PATH_AFSCREDS, &hk) == 0)
77 DWORD dwValue = g.aCreds[ iCreds ].fRemind;
78 RegSetValueEx (hk, g.aCreds[ iCreds ].szCell, NULL, REG_DWORD, (PBYTE)&dwValue, sizeof(DWORD));
84 void TimeToSystemTime (SYSTEMTIME *pst, time_t TimeT)
86 memset (pst, 0x00, sizeof(SYSTEMTIME));
89 if ((pTime = localtime (&TimeT)) != NULL)
91 pst->wYear = pTime->tm_year + 1900;
92 pst->wMonth = pTime->tm_mon + 1;
93 pst->wDayOfWeek = pTime->tm_wday;
94 pst->wDay = pTime->tm_mday;
95 pst->wHour = pTime->tm_hour;
96 pst->wMinute = pTime->tm_min;
97 pst->wSecond = pTime->tm_sec;
98 pst->wMilliseconds = 0;
103 LPARAM GetTabParam (HWND hTab, int iTab)
106 memset (&Item, 0x00, sizeof(Item));
107 Item.mask = TCIF_PARAM;
108 if (!TabCtrl_GetItem (hTab, iTab, &Item))
114 HWND GetTabChild (HWND hTab)
116 for (HWND hChild = GetWindow (hTab, GW_CHILD);
118 hChild = GetWindow (hChild, GW_HWNDNEXT))
120 TCHAR szClassName[ cchRESOURCE ];
122 if (GetClassName (hChild, szClassName, cchRESOURCE))
124 if (!lstrcmp (szClassName, TEXT("#32770"))) // WC_DIALOG