Annotation of truecrypt/format/redtick.c, revision 1.1.1.5

1.1.1.3   root        1: /* The source code contained in this file has been derived from the source code
                      2:    of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
1.1.1.5 ! root        3:    additions to that source code contained in this file are Copyright (c) 2004-2005
1.1.1.4   root        4:    TrueCrypt Foundation and Copyright (c) 2004 TrueCrypt Team. Unmodified
1.1.1.3   root        5:    parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
                      6:    release. Please see the file license.txt for full license details. */
1.1       root        7: 
                      8: #include "TCdefs.h"
                      9: #include "redtick.h"
                     10: 
                     11: LRESULT CALLBACK
                     12: RedTick (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                     13: {
                     14:   if (uMsg == WM_CREATE)
                     15:     {
                     16:     }
                     17:   else if (uMsg == WM_DESTROY)
                     18:     {
                     19:     }
                     20:   else if (uMsg == WM_TIMER)
                     21:     {
                     22:     }
                     23:   else if (uMsg == WM_PAINT)
                     24:     {
                     25:       PAINTSTRUCT tmp;
                     26:       HPEN hPen;
                     27:       HDC hDC;
                     28:       BOOL bEndPaint;
                     29:       RECT Rect;
                     30: 
                     31:       if (GetUpdateRect (hwnd, NULL, FALSE))
                     32:        {
                     33:          hDC = BeginPaint (hwnd, &tmp);
                     34:          bEndPaint = TRUE;
                     35:          if (hDC == NULL)
                     36:            return DefWindowProc (hwnd, uMsg, wParam, lParam);
                     37:        }
                     38:       else
                     39:        {
                     40:          hDC = GetDC (hwnd);
                     41:          bEndPaint = FALSE;
                     42:        }
                     43: 
                     44:       GetClientRect (hwnd, &Rect);
                     45: 
                     46:       hPen = CreatePen (PS_SOLID, 2, RGB (0, 255, 0));
                     47:       if (hPen != NULL)
                     48:        {
                     49:          HGDIOBJ hObj = SelectObject (hDC, hPen);
                     50:          WORD bx = LOWORD (GetDialogBaseUnits ());
                     51:          WORD by = HIWORD (GetDialogBaseUnits ());
                     52: 
                     53:          MoveToEx (hDC, (Rect.right - Rect.left) / 2, Rect.bottom, NULL);
                     54:          LineTo (hDC, Rect.right, Rect.top);
                     55:          MoveToEx (hDC, (Rect.right - Rect.left) / 2, Rect.bottom, NULL);
                     56: 
                     57:          LineTo (hDC, (3 * bx) / 4, (2 * by) / 8);
                     58: 
                     59:          SelectObject (hDC, hObj);
                     60:          DeleteObject (hPen);
                     61:        }
                     62: 
                     63:       if (bEndPaint == TRUE)
                     64:        EndPaint (hwnd, &tmp);
                     65:       else
                     66:        ReleaseDC (hwnd, hDC);
                     67: 
                     68:       return TRUE;
                     69:     }
                     70: 
                     71:   return DefWindowProc (hwnd, uMsg, wParam, lParam);
                     72: }
                     73: 
                     74: BOOL
                     75: RegisterRedTick (HINSTANCE hInstance)
                     76: {
                     77:   WNDCLASS wc;
                     78:   ULONG rc;
                     79: 
                     80:   memset(&wc, 0 , sizeof wc);
                     81: 
                     82:   wc.style = CS_HREDRAW | CS_VREDRAW;
                     83:   wc.cbClsExtra = 0;
                     84:   wc.cbWndExtra = 4;
                     85:   wc.hInstance = hInstance;
                     86:   wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
                     87:   wc.hCursor = NULL;
                     88:   wc.hbrBackground = GetStockObject (LTGRAY_BRUSH);
                     89:   wc.lpszClassName = "REDTICK";
                     90:   wc.lpfnWndProc = &RedTick; 
                     91:   
                     92:   rc = (ULONG) RegisterClass (&wc);
                     93: 
                     94:   return rc == 0 ? FALSE : TRUE;
                     95: }
                     96: 
                     97: BOOL
                     98: UnregisterRedTick (HINSTANCE hInstance)
                     99: {
                    100:   return UnregisterClass ("REDTICK", hInstance);
                    101: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.