Move OpenQuery into msiquery.c and make it non-static.
[wine/testsucceed.git] / dlls / comctl32 / syslink.c
blobdd82e02b4ec47551a81c5e1d46c1b63bd9ef2d2f
1 /*
2 * SysLink control
4 * Copyright 2004 Thomas Weidenmueller <w3seek@reactos.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * TODO:
21 * - Fix SHIFT+TAB and TAB issue (wrong link is selected when control gets the focus)
22 * - Better string parsing
23 * - Improve word wrapping
24 * - Control styles?!
28 #include <stdarg.h>
29 #include <string.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34 #include "winnls.h"
35 #include "commctrl.h"
36 #include "wine/unicode.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(progress);
41 INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT);
43 #define SYSLINK_Alloc(size) HeapAlloc(GetProcessHeap(), 0, (size))
44 #define SYSLINK_Free(ptr) HeapFree(GetProcessHeap(), 0, (ptr))
45 #define SYSLINK_ReAlloc(ptr, size) HeapReAlloc(GetProcessHeap(), 0, ptr, (size))
47 typedef struct
49 int nChars;
50 RECT rc;
51 } DOC_TEXTBLOCK, *PDOC_TEXTBLOCK;
53 #define LIF_FLAGSMASK (LIF_STATE | LIF_ITEMID | LIF_URL)
54 #define LIS_MASK (LIS_FOCUSED | LIS_ENABLED | LIS_VISITED)
56 typedef enum
58 slText = 0,
59 slLink
60 } SL_ITEM_TYPE;
62 typedef struct _DOC_ITEM
64 struct _DOC_ITEM *Next; /* Address to the next item */
65 LPWSTR Text; /* Text of the document item */
66 UINT nText; /* Number of characters of the text */
67 SL_ITEM_TYPE Type; /* type of the item */
68 PDOC_TEXTBLOCK Blocks; /* Array of text blocks */
69 union
71 struct
73 UINT state; /* Link state */
74 WCHAR *szID; /* Link ID string */
75 WCHAR *szUrl; /* Link URL string */
76 HRGN hRgn; /* Region of the link */
77 } Link;
78 struct
80 UINT Dummy;
81 } Text;
82 } u;
83 } DOC_ITEM, *PDOC_ITEM;
85 typedef struct
87 HWND Self; /* The window handle for this control */
88 PDOC_ITEM Items; /* Address to the first document item */
89 BOOL HasFocus; /* Whether the control has the input focus */
90 int MouseDownID; /* ID of the link that the mouse button first selected */
91 HFONT Font; /* Handle to the font for text */
92 HFONT LinkFont; /* Handle to the font for links */
93 COLORREF TextColor; /* Color of the text */
94 COLORREF LinkColor; /* Color of links */
95 COLORREF VisitedColor; /* Color of visited links */
96 } SYSLINK_INFO;
98 static const WCHAR SL_LINKOPEN[] = { '<','a', 0 };
99 static const WCHAR SL_HREF[] = { 'h','r','e','f','=','\"',0 };
100 static const WCHAR SL_ID[] = { 'i','d','=','\"',0 };
101 static const WCHAR SL_LINKCLOSE[] = { '<','/','a','>',0 };
103 /* Control configuration constants */
105 #define SL_LEFTMARGIN (0)
106 #define SL_TOPMARGIN (0)
107 #define SL_RIGHTMARGIN (0)
108 #define SL_BOTTOMMARGIN (0)
110 /***********************************************************************
111 * SYSLINK_FreeDocItem
112 * Frees all data and gdi objects associated with a document item
114 static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem)
116 if(DocItem->Type == slLink)
118 SYSLINK_Free(DocItem->u.Link.szID);
119 SYSLINK_Free(DocItem->u.Link.szUrl);
122 if(DocItem->Type == slLink && DocItem->u.Link.hRgn != NULL)
124 DeleteObject(DocItem->u.Link.hRgn);
127 /* we don't free Text because it's just a pointer to a character in the
128 entire window text string */
130 SYSLINK_Free(DocItem);
133 /***********************************************************************
134 * SYSLINK_AppendDocItem
135 * Create and append a new document item.
137 static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPWSTR Text, UINT textlen,
138 SL_ITEM_TYPE type, PDOC_ITEM LastItem)
140 PDOC_ITEM Item;
141 Item = SYSLINK_Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR)));
142 if(Item == NULL)
144 ERR("Failed to alloc DOC_ITEM structure!\n");
145 return NULL;
147 textlen = min(textlen, lstrlenW(Text));
149 Item->Next = NULL;
150 Item->Text = (LPWSTR)(Item + 1);
151 Item->nText = textlen;
152 Item->Type = type;
153 Item->Blocks = NULL;
155 if(LastItem != NULL)
157 LastItem->Next = Item;
159 else
161 infoPtr->Items = Item;
164 lstrcpynW(Item->Text, Text, textlen + 1);
165 Item->Text[textlen] = 0;
167 return Item;
170 /***********************************************************************
171 * SYSLINK_ClearDoc
172 * Clears the document tree
174 static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr)
176 PDOC_ITEM Item, Next;
178 Item = infoPtr->Items;
179 while(Item != NULL)
181 Next = Item->Next;
182 SYSLINK_FreeDocItem(Item);
183 Item = Next;
186 infoPtr->Items = NULL;
189 /***********************************************************************
190 * SYSLINK_ParseText
191 * Parses the window text string and creates a document. Returns the
192 * number of document items created.
194 static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPWSTR Text)
196 WCHAR *current, *textstart, *linktext, *firsttag;
197 int taglen = 0, textlen, linklen, docitems = 0;
198 PDOC_ITEM Last = NULL;
199 SL_ITEM_TYPE CurrentType = slText;
200 DWORD Style;
201 LPWSTR lpID, lpUrl;
202 UINT lenId, lenUrl;
204 Style = GetWindowLongW(infoPtr->Self, GWL_STYLE);
206 firsttag = NULL;
207 textstart = NULL;
208 linktext = NULL;
209 textlen = 0;
210 linklen = 0;
212 for(current = (WCHAR*)Text; *current != 0;)
214 if(*current == '<')
216 if(!StrCmpNIW(current, SL_LINKOPEN, 2) && (CurrentType == slText))
218 BOOL ValidParam = FALSE, ValidLink = FALSE;
220 switch (*(current + 2))
222 case '>':
223 /* we just have to deal with a <a> tag */
224 taglen = 3;
225 ValidLink = TRUE;
226 ValidParam = TRUE;
227 firsttag = current;
228 linklen = 0;
229 lpID = NULL;
230 lpUrl = NULL;
231 break;
232 case ' ':
234 /* we expect parameters, parse them */
235 LPWSTR *CurrentParameter = NULL;
236 UINT *CurrentParameterLen = NULL;
237 WCHAR *tmp;
239 taglen = 3;
240 tmp = current + taglen;
241 lpID = NULL;
242 lpUrl = NULL;
244 CheckParameter:
245 /* compare the current position with all known parameters */
246 if(!StrCmpNIW(tmp, SL_HREF, 6))
248 taglen += 6;
249 ValidParam = TRUE;
250 CurrentParameter = &lpUrl;
251 CurrentParameterLen = &lenUrl;
253 else if(!StrCmpNIW(tmp, SL_ID, 4))
255 taglen += 4;
256 ValidParam = TRUE;
257 CurrentParameter = &lpID;
258 CurrentParameterLen = &lenId;
260 else
262 ValidParam = FALSE;
265 if(ValidParam)
267 /* we got a known parameter, now search until the next " character.
268 If we can't find a " character, there's a syntax error and we just assume it's text */
269 ValidParam = FALSE;
270 *CurrentParameter = current + taglen;
271 *CurrentParameterLen = 0;
273 for(tmp = *CurrentParameter; *tmp != 0; tmp++)
275 taglen++;
276 if(*tmp == '\"')
278 ValidParam = TRUE;
279 tmp++;
280 break;
282 (*CurrentParameterLen)++;
285 if(ValidParam)
287 /* we're done with this parameter, now there are only 2 possibilities:
288 * 1. another parameter is coming, so expect a ' ' (space) character
289 * 2. the tag is being closed, so expect a '<' character
291 switch(*tmp)
293 case ' ':
294 /* we expect another parameter, do the whole thing again */
295 taglen++;
296 tmp++;
297 goto CheckParameter;
299 case '>':
300 /* the tag is being closed, we're done */
301 ValidLink = TRUE;
302 taglen++;
303 break;
304 default:
305 tmp++;
306 break;
310 break;
314 if(ValidLink && ValidParam)
316 /* the <a ...> tag appears to be valid. save all information
317 so we can add the link if we find a valid </a> tag later */
318 CurrentType = slLink;
319 linktext = current + taglen;
320 linklen = 0;
321 firsttag = current;
323 else
325 taglen = 1;
326 lpID = NULL;
327 lpUrl = NULL;
328 if(textstart == NULL)
330 textstart = current;
334 else if(!StrCmpNIW(current, SL_LINKCLOSE, 4) && (CurrentType == slLink) && firsttag)
336 /* there's a <a...> tag opened, first add the previous text, if present */
337 if(textstart != NULL && textlen > 0 && firsttag > textstart)
339 Last = SYSLINK_AppendDocItem(infoPtr, textstart, firsttag - textstart, slText, Last);
340 if(Last == NULL)
342 ERR("Unable to create new document item!\n");
343 return docitems;
345 docitems++;
346 textstart = NULL;
347 textlen = 0;
350 /* now it's time to add the link to the document */
351 current += 4;
352 if(linktext != NULL && linklen > 0)
354 Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slLink, Last);
355 if(Last == NULL)
357 ERR("Unable to create new document item!\n");
358 return docitems;
360 docitems++;
361 if(CurrentType == slLink)
363 int nc;
365 if(!(Style & WS_DISABLED))
367 Last->u.Link.state |= LIS_ENABLED;
369 /* Copy the tag parameters */
370 if(lpID != NULL)
372 nc = min(lenId, strlenW(lpID));
373 nc = min(nc, MAX_LINKID_TEXT);
374 Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
375 if(Last->u.Link.szID != NULL)
377 lstrcpynW(Last->u.Link.szID, lpID, nc + 1);
378 Last->u.Link.szID[nc] = 0;
381 else
382 Last->u.Link.szID = NULL;
383 if(lpUrl != NULL)
385 nc = min(lenUrl, strlenW(lpUrl));
386 nc = min(nc, L_MAX_URL_LENGTH);
387 Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
388 if(Last->u.Link.szUrl != NULL)
390 lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1);
391 Last->u.Link.szUrl[nc] = 0;
394 else
395 Last->u.Link.szUrl = NULL;
397 linktext = NULL;
399 CurrentType = slText;
400 firsttag = NULL;
401 textstart = NULL;
402 continue;
404 else
406 /* we don't know what tag it is, so just continue */
407 taglen = 1;
408 linklen++;
409 if(CurrentType == slText && textstart == NULL)
411 textstart = current;
415 textlen += taglen;
416 current += taglen;
418 else
420 textlen++;
421 linklen++;
423 /* save the pointer of the current text item if we couldn't find a tag */
424 if(textstart == NULL && CurrentType == slText)
426 textstart = current;
429 current++;
433 if(textstart != NULL && textlen > 0)
435 Last = SYSLINK_AppendDocItem(infoPtr, textstart, textlen, CurrentType, Last);
436 if(Last == NULL)
438 ERR("Unable to create new document item!\n");
439 return docitems;
441 if(CurrentType == slLink)
443 int nc;
445 if(!(Style & WS_DISABLED))
447 Last->u.Link.state |= LIS_ENABLED;
449 /* Copy the tag parameters */
450 if(lpID != NULL)
452 nc = min(lenId, strlenW(lpID));
453 nc = min(nc, MAX_LINKID_TEXT);
454 Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
455 if(Last->u.Link.szID != NULL)
457 lstrcpynW(Last->u.Link.szID, lpID, nc + 1);
458 Last->u.Link.szID[nc] = 0;
461 else
462 Last->u.Link.szID = NULL;
463 if(lpUrl != NULL)
465 nc = min(lenUrl, strlenW(lpUrl));
466 nc = min(nc, L_MAX_URL_LENGTH);
467 Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
468 if(Last->u.Link.szUrl != NULL)
470 lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1);
471 Last->u.Link.szUrl[nc] = 0;
474 else
475 Last->u.Link.szUrl = NULL;
477 docitems++;
480 if(linktext != NULL && linklen > 0)
482 /* we got a unclosed link, just display the text */
483 Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slText, Last);
484 if(Last == NULL)
486 ERR("Unable to create new document item!\n");
487 return docitems;
489 docitems++;
492 return docitems;
495 /***********************************************************************
496 * SYSLINK_RepaintLink
497 * Repaints a link.
499 static VOID SYSLINK_RepaintLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
501 if(DocItem->Type != slLink)
503 ERR("DocItem not a link!\n");
504 return;
507 if(DocItem->u.Link.hRgn != NULL)
509 /* repaint the region */
510 RedrawWindow(infoPtr->Self, NULL, DocItem->u.Link.hRgn, RDW_INVALIDATE | RDW_UPDATENOW);
514 /***********************************************************************
515 * SYSLINK_GetLinkItemByIndex
516 * Retreives a document link by it's index
518 static PDOC_ITEM SYSLINK_GetLinkItemByIndex (SYSLINK_INFO *infoPtr, int iLink)
520 PDOC_ITEM Current = infoPtr->Items;
522 while(Current != NULL)
524 if((Current->Type == slLink) && (iLink-- <= 0))
526 return Current;
528 Current = Current->Next;
530 return NULL;
533 /***********************************************************************
534 * SYSLINK_GetFocusLink
535 * Retreives the link that has the LIS_FOCUSED bit
537 static PDOC_ITEM SYSLINK_GetFocusLink (SYSLINK_INFO *infoPtr, int *LinkId)
539 PDOC_ITEM Current = infoPtr->Items;
540 int id = 0;
542 while(Current != NULL)
544 if((Current->Type == slLink))
546 if(Current->u.Link.state & LIS_FOCUSED)
548 if(LinkId != NULL)
549 *LinkId = id;
550 return Current;
552 id++;
554 Current = Current->Next;
556 return NULL;
559 /***********************************************************************
560 * SYSLINK_GetNextLink
561 * Gets the next link
563 static PDOC_ITEM SYSLINK_GetNextLink (SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
565 for(Current = (Current != NULL ? Current->Next : infoPtr->Items);
566 Current != NULL;
567 Current = Current->Next)
569 if(Current->Type == slLink)
571 return Current;
574 return NULL;
577 /***********************************************************************
578 * SYSLINK_GetPrevLink
579 * Gets the previous link
581 static PDOC_ITEM SYSLINK_GetPrevLink (SYSLINK_INFO *infoPtr, PDOC_ITEM Current)
583 if(Current == NULL)
585 /* returns the last link */
586 PDOC_ITEM Last = NULL;
588 for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
590 if(Current->Type == slLink)
592 Last = Current;
595 return Last;
597 else
599 /* returns the previous link */
600 PDOC_ITEM Cur, Prev = NULL;
602 for(Cur = infoPtr->Items; Cur != NULL; Cur = Cur->Next)
604 if(Cur == Current)
606 break;
608 if(Cur->Type == slLink)
610 Prev = Cur;
613 return Prev;
617 /***********************************************************************
618 * SYSLINK_WrapLine
619 * Tries to wrap a line.
621 static BOOL SYSLINK_WrapLine (HDC hdc, LPWSTR Text, WCHAR BreakChar, int *LineLen, int nFit, LPSIZE Extent, int Width)
623 WCHAR *Current;
625 if(nFit == *LineLen)
627 return FALSE;
630 *LineLen = nFit;
632 Current = Text + nFit;
634 /* check if we're in the middle of a word */
635 if((*Current) != BreakChar)
637 /* search for the beginning of the word */
638 while(Current > Text && (*(Current - 1)) != BreakChar)
640 Current--;
641 (*LineLen)--;
644 if((*LineLen) == 0)
646 Extent->cx = 0;
647 Extent->cy = 0;
649 return TRUE;
652 return TRUE;
655 /***********************************************************************
656 * SYSLINK_Render
657 * Renders the document in memory
659 static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
661 RECT rc;
662 PDOC_ITEM Current;
663 HGDIOBJ hOldFont;
664 int x, y, LineHeight;
665 TEXTMETRICW tm;
667 GetClientRect(infoPtr->Self, &rc);
668 rc.right -= SL_RIGHTMARGIN;
669 rc.bottom -= SL_BOTTOMMARGIN;
671 if(rc.right - SL_LEFTMARGIN < 0 || rc.bottom - SL_TOPMARGIN < 0) return;
673 hOldFont = SelectObject(hdc, infoPtr->Font);
674 GetTextMetricsW(hdc, &tm);
676 x = SL_LEFTMARGIN;
677 y = SL_TOPMARGIN;
678 LineHeight = 0;
680 for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
682 int n, nBlocks;
683 LPWSTR tx;
684 PDOC_TEXTBLOCK bl, cbl;
685 INT nFit;
686 SIZE szDim;
688 if(Current->nText == 0)
690 ERR("DOC_ITEM with no text?!\n");
691 continue;
694 tx = Current->Text;
695 n = Current->nText;
696 bl = Current->Blocks;
697 nBlocks = 0;
699 if(Current->Type == slText)
701 SelectObject(hdc, infoPtr->Font);
703 else if(Current->Type == slLink)
705 SelectObject(hdc, infoPtr->LinkFont);
708 while(n > 0)
710 if(GetTextExtentExPointW(hdc, tx, n, rc.right - x, &nFit, NULL, &szDim))
712 int LineLen = n;
713 BOOL Wrap = SYSLINK_WrapLine(hdc, tx, tm.tmBreakChar, &LineLen, nFit, &szDim, rc.right - x);
715 if(LineLen == 0)
717 if(x > SL_LEFTMARGIN)
719 /* move one line down, the word didn't fit into the line */
720 x = SL_LEFTMARGIN;
721 y += LineHeight;
722 LineHeight = 0;
723 continue;
725 else
727 /* the word starts at the beginning of the line and doesn't
728 fit into the line, so break it at the last character that fits */
729 LineLen = max(nFit, 1);
733 if(LineLen != n)
735 GetTextExtentExPointW(hdc, tx, LineLen, rc.right - x, NULL, NULL, &szDim);
738 if(bl != NULL)
740 bl = SYSLINK_ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK));
742 else
744 bl = SYSLINK_Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK));
747 if(bl != NULL)
749 cbl = bl + nBlocks - 1;
751 cbl->nChars = LineLen;
752 cbl->rc.left = x;
753 cbl->rc.top = y;
754 cbl->rc.right = x + szDim.cx;
755 cbl->rc.bottom = y + szDim.cy;
757 x += szDim.cx;
758 LineHeight = max(LineHeight, szDim.cy);
760 /* (re)calculate the link's region */
761 if(Current->Type == slLink)
763 if(nBlocks <= 1)
765 if(Current->u.Link.hRgn != NULL)
767 DeleteObject(Current->u.Link.hRgn);
769 /* initialize the link's hRgn */
770 Current->u.Link.hRgn = CreateRectRgnIndirect(&cbl->rc);
772 else if(Current->u.Link.hRgn != NULL)
774 HRGN hrgn;
775 hrgn = CreateRectRgnIndirect(&cbl->rc);
776 /* add the rectangle */
777 CombineRgn(Current->u.Link.hRgn, Current->u.Link.hRgn, hrgn, RGN_OR);
778 DeleteObject(hrgn);
782 if(Wrap)
784 x = SL_LEFTMARGIN;
785 y += LineHeight;
786 LineHeight = 0;
789 else
791 ERR("Failed to alloc DOC_TEXTBLOCK structure!\n");
792 break;
794 n -= LineLen;
795 tx += LineLen;
797 else
799 ERR("GetTextExtentExPoint() failed?!\n");
800 n--;
803 Current->Blocks = bl;
806 SelectObject(hdc, hOldFont);
809 /***********************************************************************
810 * SYSLINK_Draw
811 * Draws the SysLink control.
813 static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc)
815 RECT rc;
816 PDOC_ITEM Current;
817 HFONT hOldFont;
818 COLORREF OldTextColor, OldBkColor;
820 hOldFont = SelectObject(hdc, infoPtr->Font);
821 OldTextColor = SetTextColor(hdc, infoPtr->TextColor);
822 OldBkColor = SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
824 GetClientRect(infoPtr->Self, &rc);
825 rc.right -= SL_RIGHTMARGIN + SL_LEFTMARGIN;
826 rc.bottom -= SL_BOTTOMMARGIN + SL_TOPMARGIN;
828 if(rc.right < 0 || rc.bottom < 0) return 0;
830 for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
832 int n;
833 LPWSTR tx;
834 PDOC_TEXTBLOCK bl;
836 bl = Current->Blocks;
837 if(bl != NULL)
839 tx = Current->Text;
840 n = Current->nText;
842 if(Current->Type == slText)
844 SelectObject(hdc, infoPtr->Font);
845 SetTextColor(hdc, infoPtr->TextColor);
847 else
849 SelectObject(hdc, infoPtr->LinkFont);
850 SetTextColor(hdc, (!(Current->u.Link.state & LIS_VISITED) ? infoPtr->LinkColor : infoPtr->VisitedColor));
853 while(n > 0)
855 ExtTextOutW(hdc, bl->rc.left, bl->rc.top, ETO_OPAQUE | ETO_CLIPPED, &bl->rc, tx, bl->nChars, NULL);
856 if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus)
858 COLORREF PrevColor;
859 PrevColor = SetBkColor(hdc, OldBkColor);
860 DrawFocusRect(hdc, &bl->rc);
861 SetBkColor(hdc, PrevColor);
863 tx += bl->nChars;
864 n -= bl->nChars;
865 bl++;
870 SetBkColor(hdc, OldBkColor);
871 SetTextColor(hdc, OldTextColor);
872 SelectObject(hdc, hOldFont);
874 return 0;
878 /***********************************************************************
879 * SYSLINK_Paint
880 * Handles the WM_PAINT message.
882 static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr)
884 HDC hdc;
885 PAINTSTRUCT ps;
886 hdc = BeginPaint (infoPtr->Self, &ps);
887 SYSLINK_Draw (infoPtr, hdc);
888 EndPaint (infoPtr->Self, &ps);
889 return 0;
893 /***********************************************************************
894 * SYSLINK_SetFont
895 * Set new Font for the SysLink control.
897 static HFONT SYSLINK_SetFont (SYSLINK_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
899 HDC hdc;
900 LOGFONTW lf;
901 HFONT hOldFont = infoPtr->Font;
902 infoPtr->Font = hFont;
904 /* free the underline font */
905 if(infoPtr->LinkFont != NULL)
907 DeleteObject(infoPtr->LinkFont);
908 infoPtr->LinkFont = NULL;
911 /* Render text position and word wrapping in memory */
912 hdc = GetDC(infoPtr->Self);
913 if(hdc != NULL)
915 /* create a new underline font */
916 if(GetObjectW(infoPtr->Font, sizeof(LOGFONTW), &lf))
918 lf.lfUnderline = TRUE;
919 infoPtr->LinkFont = CreateFontIndirectW(&lf);
921 else
923 ERR("Failed to create link font!\n");
926 SYSLINK_Render(infoPtr, hdc);
927 ReleaseDC(infoPtr->Self, hdc);
930 if(bRedraw)
932 RedrawWindow(infoPtr->Self, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
935 return hOldFont;
938 /***********************************************************************
939 * SYSLINK_SetText
940 * Set new text for the SysLink control.
942 static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPWSTR Text)
944 int textlen;
946 /* clear the document */
947 SYSLINK_ClearDoc(infoPtr);
949 textlen = lstrlenW(Text);
950 if(Text == NULL || textlen == 0)
952 return TRUE;
955 /* let's parse the string and create a document */
956 if(SYSLINK_ParseText(infoPtr, Text) > 0)
958 /* Render text position and word wrapping in memory */
959 HDC hdc = GetDC(infoPtr->Self);
960 SYSLINK_Render(infoPtr, hdc);
961 SYSLINK_Draw(infoPtr, hdc);
962 ReleaseDC(infoPtr->Self, hdc);
965 return TRUE;
968 /***********************************************************************
969 * SYSLINK_SetFocusLink
970 * Updates the focus status bits and focusses the specified link.
971 * If no document item is specified, the focus bit will be removed from all links.
972 * Returns the previous focused item.
974 static PDOC_ITEM SYSLINK_SetFocusLink (SYSLINK_INFO *infoPtr, PDOC_ITEM DocItem)
976 PDOC_ITEM Current, PrevFocus = NULL;
978 for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
980 if(Current->Type == slLink)
982 if((PrevFocus == NULL) && (Current->u.Link.state & LIS_FOCUSED))
984 PrevFocus = Current;
987 if(Current == DocItem)
989 Current->u.Link.state |= LIS_FOCUSED;
991 else
993 Current->u.Link.state &= ~LIS_FOCUSED;
998 return PrevFocus;
1001 /***********************************************************************
1002 * SYSLINK_SetItem
1003 * Sets the states and attributes of a link item.
1005 static LRESULT SYSLINK_SetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
1007 PDOC_ITEM di;
1008 BOOL Repaint = FALSE;
1009 BOOL Ret = TRUE;
1011 if(!(Item->mask & LIF_ITEMINDEX) || !(Item->mask & (LIF_FLAGSMASK)))
1013 ERR("Invalid Flags!\n");
1014 return FALSE;
1017 di = SYSLINK_GetLinkItemByIndex(infoPtr, Item->iLink);
1018 if(di == NULL)
1020 ERR("Link %d couldn't be found\n", Item->iLink);
1021 return FALSE;
1024 if(Item->mask & LIF_STATE)
1026 UINT oldstate = di->u.Link.state;
1027 /* clear the masked bits */
1028 di->u.Link.state &= ~(Item->stateMask & LIS_MASK);
1029 /* copy the bits */
1030 di->u.Link.state |= (Item->state & Item->stateMask) & LIS_MASK;
1031 Repaint = (oldstate != di->u.Link.state);
1033 /* update the focus */
1034 SYSLINK_SetFocusLink(infoPtr, ((di->u.Link.state & LIS_FOCUSED) ? di : NULL));
1037 if(Item->mask & LIF_ITEMID)
1039 if(!di->u.Link.szID)
1041 di->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
1042 if(!Item->szID)
1044 ERR("Unable to allocate memory for link id\n");
1045 Ret = FALSE;
1048 if(di->u.Link.szID)
1050 lstrcpynW(di->u.Link.szID, Item->szID, MAX_LINKID_TEXT + 1);
1054 if(Item->mask & LIF_URL)
1056 if(!di->u.Link.szUrl)
1058 di->u.Link.szUrl = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
1059 if(!Item->szUrl)
1061 ERR("Unable to allocate memory for link url\n");
1062 Ret = FALSE;
1065 if(di->u.Link.szUrl)
1067 lstrcpynW(di->u.Link.szUrl, Item->szUrl, MAX_LINKID_TEXT + 1);
1071 if(Repaint)
1073 SYSLINK_RepaintLink(infoPtr, di);
1076 return Ret;
1079 /***********************************************************************
1080 * SYSLINK_GetItem
1081 * Retrieves the states and attributes of a link item.
1083 static LRESULT SYSLINK_GetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
1085 PDOC_ITEM di;
1087 if(!(Item->mask & LIF_ITEMINDEX) || !(Item->mask & (LIF_FLAGSMASK)))
1089 ERR("Invalid Flags!\n");
1090 return FALSE;
1093 di = SYSLINK_GetLinkItemByIndex(infoPtr, Item->iLink);
1094 if(di == NULL)
1096 ERR("Link %d couldn't be found\n", Item->iLink);
1097 return FALSE;
1100 if(Item->mask & LIF_STATE)
1102 Item->state = (di->u.Link.state & Item->stateMask);
1103 if(!infoPtr->HasFocus)
1105 /* remove the LIS_FOCUSED bit if the control doesn't have focus */
1106 Item->state &= ~LIS_FOCUSED;
1110 if(Item->mask & LIF_ITEMID)
1112 if(di->u.Link.szID)
1114 lstrcpynW(Item->szID, di->u.Link.szID, MAX_LINKID_TEXT + 1);
1116 else
1118 Item->szID[0] = 0;
1122 if(Item->mask & LIF_URL)
1124 if(di->u.Link.szUrl)
1126 lstrcpynW(Item->szUrl, di->u.Link.szUrl, L_MAX_URL_LENGTH + 1);
1128 else
1130 Item->szUrl[0] = 0;
1134 return TRUE;
1137 /***********************************************************************
1138 * SYSLINK_HitTest
1139 * Determines the link the user clicked on.
1141 static LRESULT SYSLINK_HitTest (SYSLINK_INFO *infoPtr, PLHITTESTINFO HitTest)
1143 PDOC_ITEM Current;
1144 int id = 0;
1146 for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
1148 if(Current->Type == slLink)
1150 if((Current->u.Link.hRgn != NULL) &&
1151 PtInRegion(Current->u.Link.hRgn, HitTest->pt.x, HitTest->pt.y))
1153 HitTest->item.mask = 0;
1154 HitTest->item.iLink = id;
1155 HitTest->item.state = 0;
1156 HitTest->item.stateMask = 0;
1157 if(Current->u.Link.szID)
1159 lstrcpynW(HitTest->item.szID, Current->u.Link.szID, MAX_LINKID_TEXT + 1);
1161 else
1163 HitTest->item.szID[0] = 0;
1165 if(Current->u.Link.szUrl)
1167 lstrcpynW(HitTest->item.szUrl, Current->u.Link.szUrl, L_MAX_URL_LENGTH + 1);
1169 else
1171 HitTest->item.szUrl[0] = 0;
1173 return TRUE;
1175 id++;
1179 return FALSE;
1182 /***********************************************************************
1183 * SYSLINK_GetIdealHeight
1184 * Returns the preferred height of a link at the current control's width.
1186 static LRESULT SYSLINK_GetIdealHeight (SYSLINK_INFO *infoPtr)
1188 HDC hdc = GetDC(infoPtr->Self);
1189 if(hdc != NULL)
1191 LRESULT height;
1192 TEXTMETRICW tm;
1193 HGDIOBJ hOldFont = SelectObject(hdc, infoPtr->Font);
1195 if(GetTextMetricsW(hdc, &tm))
1197 height = tm.tmHeight;
1199 else
1201 height = 0;
1203 SelectObject(hdc, hOldFont);
1204 ReleaseDC(infoPtr->Self, hdc);
1206 return height;
1208 return 0;
1211 /***********************************************************************
1212 * SYSLINK_SendParentNotify
1213 * Sends a WM_NOTIFY message to the parent window.
1215 static LRESULT SYSLINK_SendParentNotify (SYSLINK_INFO *infoPtr, UINT code, PDOC_ITEM Link, int iLink)
1217 NMLINK nml;
1219 nml.hdr.hwndFrom = infoPtr->Self;
1220 nml.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID);
1221 nml.hdr.code = code;
1223 nml.item.mask = 0;
1224 nml.item.iLink = iLink;
1225 nml.item.state = 0;
1226 nml.item.stateMask = 0;
1227 if(Link->u.Link.szID)
1229 lstrcpynW(nml.item.szID, Link->u.Link.szID, MAX_LINKID_TEXT + 1);
1231 else
1233 nml.item.szID[0] = 0;
1235 if(Link->u.Link.szUrl)
1237 lstrcpynW(nml.item.szUrl, Link->u.Link.szUrl, L_MAX_URL_LENGTH + 1);
1239 else
1241 nml.item.szUrl[0] = 0;
1244 return SendMessageW(GetParent(infoPtr->Self), WM_NOTIFY, (WPARAM)nml.hdr.idFrom, (LPARAM)&nml);
1247 /***********************************************************************
1248 * SYSLINK_SetFocus
1249 * Handles receiving the input focus.
1251 static LRESULT SYSLINK_SetFocus (SYSLINK_INFO *infoPtr, HWND PrevFocusWindow)
1253 PDOC_ITEM Focus;
1255 infoPtr->HasFocus = TRUE;
1257 #if 1
1258 /* FIXME - How to detect whether SHIFT+TAB or just TAB has been pressed?
1259 * The problem is we could get this message without keyboard input, too
1261 Focus = SYSLINK_GetFocusLink(infoPtr, NULL);
1263 if(Focus == NULL && (Focus = SYSLINK_GetNextLink(infoPtr, NULL)))
1265 SYSLINK_SetFocusLink(infoPtr, Focus);
1267 #else
1268 /* This is a temporary hack since I'm not really sure how to detect which link to select.
1269 See message above! */
1270 Focus = SYSLINK_GetNextLink(infoPtr, NULL);
1271 if(Focus != NULL)
1273 SYSLINK_SetFocusLink(infoPtr, Focus);
1275 #endif
1277 SYSLINK_RepaintLink(infoPtr, Focus);
1279 return 0;
1282 /***********************************************************************
1283 * SYSLINK_KillFocus
1284 * Handles losing the input focus.
1286 static LRESULT SYSLINK_KillFocus (SYSLINK_INFO *infoPtr, HWND NewFocusWindow)
1288 PDOC_ITEM Focus;
1290 infoPtr->HasFocus = FALSE;
1291 Focus = SYSLINK_GetFocusLink(infoPtr, NULL);
1293 if(Focus != NULL)
1295 SYSLINK_RepaintLink(infoPtr, Focus);
1298 return 0;
1301 /***********************************************************************
1302 * SYSLINK_LinkAtPt
1303 * Returns a link at the specified position
1305 static PDOC_ITEM SYSLINK_LinkAtPt (SYSLINK_INFO *infoPtr, POINT *pt, int *LinkId, BOOL MustBeEnabled)
1307 PDOC_ITEM Current;
1308 int id = 0;
1310 for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
1312 if((Current->Type == slLink) && (Current->u.Link.hRgn != NULL) &&
1313 PtInRegion(Current->u.Link.hRgn, pt->x, pt->y) &&
1314 (!MustBeEnabled || (MustBeEnabled && (Current->u.Link.state & LIS_ENABLED))))
1316 if(LinkId != NULL)
1318 *LinkId = id;
1320 return Current;
1322 id++;
1325 return NULL;
1328 /***********************************************************************
1329 * SYSLINK_LButtonDown
1330 * Handles mouse clicks
1332 static LRESULT SYSLINK_LButtonDown (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT *pt)
1334 PDOC_ITEM Current, Old;
1335 int id;
1337 Current = SYSLINK_LinkAtPt(infoPtr, pt, &id, TRUE);
1338 if(Current != NULL)
1340 Old = SYSLINK_SetFocusLink(infoPtr, Current);
1341 if(Old != NULL && Old != Current)
1343 SYSLINK_RepaintLink(infoPtr, Old);
1345 infoPtr->MouseDownID = id;
1346 SYSLINK_RepaintLink(infoPtr, Current);
1347 SetFocus(infoPtr->Self);
1350 return 0;
1353 /***********************************************************************
1354 * SYSLINK_LButtonUp
1355 * Handles mouse clicks
1357 static LRESULT SYSLINK_LButtonUp (SYSLINK_INFO *infoPtr, DWORD Buttons, POINT *pt)
1359 if(infoPtr->MouseDownID > -1)
1361 PDOC_ITEM Current;
1362 int id;
1364 Current = SYSLINK_LinkAtPt(infoPtr, pt, &id, TRUE);
1365 if((Current != NULL) && (Current->u.Link.state & LIS_FOCUSED) && (infoPtr->MouseDownID == id))
1367 SYSLINK_SendParentNotify(infoPtr, NM_CLICK, Current, id);
1371 infoPtr->MouseDownID = -1;
1373 return 0;
1376 /***********************************************************************
1377 * SYSLINK_OnEnter
1378 * Handles ENTER key events
1380 static BOOL SYSLINK_OnEnter (SYSLINK_INFO *infoPtr)
1382 if(infoPtr->HasFocus)
1384 PDOC_ITEM Focus;
1385 int id;
1387 Focus = SYSLINK_GetFocusLink(infoPtr, &id);
1388 if(Focus != NULL)
1390 SYSLINK_SendParentNotify(infoPtr, NM_RETURN, Focus, id);
1391 return TRUE;
1394 return FALSE;
1397 /***********************************************************************
1398 * SYSKEY_SelectNextPrevLink
1399 * Changes the currently focused link
1401 static BOOL SYSKEY_SelectNextPrevLink (SYSLINK_INFO *infoPtr, BOOL Prev)
1403 if(infoPtr->HasFocus)
1405 PDOC_ITEM Focus;
1406 int id;
1408 Focus = SYSLINK_GetFocusLink(infoPtr, &id);
1409 if(Focus != NULL)
1411 PDOC_ITEM NewFocus, OldFocus;
1413 if(Prev)
1414 NewFocus = SYSLINK_GetPrevLink(infoPtr, Focus);
1415 else
1416 NewFocus = SYSLINK_GetNextLink(infoPtr, Focus);
1418 if(NewFocus != NULL)
1420 OldFocus = SYSLINK_SetFocusLink(infoPtr, NewFocus);
1422 if(OldFocus != NewFocus)
1424 SYSLINK_RepaintLink(infoPtr, OldFocus);
1426 SYSLINK_RepaintLink(infoPtr, NewFocus);
1427 return TRUE;
1431 return FALSE;
1434 /***********************************************************************
1435 * SYSKEY_SelectNextPrevLink
1436 * Determines if there's a next or previous link to decide whether the control
1437 * should capture the tab key message
1439 static BOOL SYSLINK_NoNextLink (SYSLINK_INFO *infoPtr, BOOL Prev)
1441 PDOC_ITEM Focus, NewFocus;
1443 Focus = SYSLINK_GetFocusLink(infoPtr, NULL);
1444 if(Prev)
1445 NewFocus = SYSLINK_GetPrevLink(infoPtr, Focus);
1446 else
1447 NewFocus = SYSLINK_GetNextLink(infoPtr, Focus);
1449 return NewFocus == NULL;
1452 /***********************************************************************
1453 * SysLinkWindowProc
1455 static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
1456 WPARAM wParam, LPARAM lParam)
1458 SYSLINK_INFO *infoPtr;
1460 TRACE("hwnd=%p msg=%04x wparam=%x lParam=%lx\n", hwnd, message, wParam, lParam);
1462 infoPtr = (SYSLINK_INFO *)GetWindowLongPtrW(hwnd, 0);
1464 if (!infoPtr && message != WM_CREATE)
1465 return DefWindowProcW( hwnd, message, wParam, lParam );
1467 switch(message) {
1468 case WM_PAINT:
1469 return SYSLINK_Paint (infoPtr);
1471 case WM_SETCURSOR:
1473 LHITTESTINFO ht;
1474 DWORD mp = GetMessagePos();
1476 ht.pt.x = (short)LOWORD(mp);
1477 ht.pt.y = (short)HIWORD(mp);
1479 ScreenToClient(infoPtr->Self, &ht.pt);
1480 if(SYSLINK_HitTest (infoPtr, &ht))
1482 SetCursor(LoadCursorW(0, (LPCWSTR)IDC_HAND));
1483 return TRUE;
1485 /* let the default window proc handle this message */
1486 return DefWindowProcW(hwnd, message, wParam, lParam);
1490 case WM_SIZE:
1492 HDC hdc = GetDC(infoPtr->Self);
1493 if(hdc != NULL)
1495 SYSLINK_Render(infoPtr, hdc);
1496 ReleaseDC(infoPtr->Self, hdc);
1498 return 0;
1501 case WM_GETFONT:
1502 return (LRESULT)infoPtr->Font;
1504 case WM_SETFONT:
1505 return (LRESULT)SYSLINK_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam);
1507 case WM_SETTEXT:
1508 SYSLINK_SetText(infoPtr, (LPWSTR)lParam);
1509 return DefWindowProcW(hwnd, message, wParam, lParam);
1511 case WM_LBUTTONDOWN:
1513 POINT pt;
1514 pt.x = LOWORD(lParam);
1515 pt.y = HIWORD(lParam);
1516 return SYSLINK_LButtonDown(infoPtr, wParam, &pt);
1518 case WM_LBUTTONUP:
1520 POINT pt;
1521 pt.x = LOWORD(lParam);
1522 pt.y = HIWORD(lParam);
1523 return SYSLINK_LButtonUp(infoPtr, wParam, &pt);
1526 case WM_KEYDOWN:
1528 switch(wParam)
1530 case VK_RETURN:
1531 SYSLINK_OnEnter(infoPtr);
1532 return 0;
1533 case VK_TAB:
1535 BOOL shift = GetKeyState(VK_SHIFT) & 0x8000;
1536 SYSKEY_SelectNextPrevLink(infoPtr, shift);
1537 return 0;
1540 return DefWindowProcW(hwnd, message, wParam, lParam);
1543 case WM_GETDLGCODE:
1545 LRESULT Ret = DLGC_HASSETSEL;
1546 int vk = (lParam != 0 ? (int)((LPMSG)lParam)->wParam : 0);
1547 switch(vk)
1549 case VK_RETURN:
1550 Ret |= DLGC_WANTMESSAGE;
1551 break;
1552 case VK_TAB:
1554 BOOL shift = GetKeyState(VK_SHIFT) & 0x8000;
1555 if(!SYSLINK_NoNextLink(infoPtr, shift))
1557 Ret |= DLGC_WANTTAB;
1559 else
1561 Ret |= DLGC_WANTCHARS;
1563 break;
1566 return Ret;
1569 case WM_NCHITTEST:
1571 POINT pt;
1572 RECT rc;
1573 pt.x = LOWORD(lParam);
1574 pt.y = HIWORD(lParam);
1576 GetClientRect(infoPtr->Self, &rc);
1577 ScreenToClient(infoPtr->Self, &pt);
1578 if(pt.x < 0 || pt.y < 0 || pt.x > rc.right || pt.y > rc.bottom)
1580 return HTNOWHERE;
1583 if(SYSLINK_LinkAtPt(infoPtr, &pt, NULL, FALSE))
1585 return HTCLIENT;
1588 return HTTRANSPARENT;
1591 case LM_HITTEST:
1592 return SYSLINK_HitTest(infoPtr, (PLHITTESTINFO)lParam);
1594 case LM_SETITEM:
1595 return SYSLINK_SetItem(infoPtr, (PLITEM)lParam);
1597 case LM_GETITEM:
1598 return SYSLINK_GetItem(infoPtr, (PLITEM)lParam);
1600 case LM_GETIDEALHEIGHT:
1601 return SYSLINK_GetIdealHeight(infoPtr);
1603 case WM_SETFOCUS:
1604 return SYSLINK_SetFocus(infoPtr, (HWND)wParam);
1606 case WM_KILLFOCUS:
1607 return SYSLINK_KillFocus(infoPtr, (HWND)wParam);
1609 case WM_CREATE:
1610 /* allocate memory for info struct */
1611 infoPtr = (SYSLINK_INFO *)SYSLINK_Alloc (sizeof(SYSLINK_INFO));
1612 if (!infoPtr) return -1;
1613 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
1615 /* initialize the info struct */
1616 infoPtr->Self = hwnd;
1617 infoPtr->Font = 0;
1618 infoPtr->LinkFont = 0;
1619 infoPtr->Items = NULL;
1620 infoPtr->HasFocus = FALSE;
1621 infoPtr->MouseDownID = -1;
1622 infoPtr->TextColor = GetSysColor(COLOR_WINDOWTEXT);
1623 infoPtr->LinkColor = GetSysColor(COLOR_HIGHLIGHT);
1624 infoPtr->VisitedColor = GetSysColor(COLOR_HIGHLIGHT);
1625 TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd);
1626 lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
1627 SYSLINK_SetText(infoPtr, (LPWSTR)lParam);
1628 return 0;
1630 case WM_DESTROY:
1631 TRACE("SysLink Ctrl destruction, hwnd=%p\n", hwnd);
1632 SYSLINK_ClearDoc(infoPtr);
1633 if(infoPtr->Font != 0) DeleteObject(infoPtr->Font);
1634 if(infoPtr->LinkFont != 0) DeleteObject(infoPtr->LinkFont);
1635 SYSLINK_Free (infoPtr);
1636 SetWindowLongPtrW(hwnd, 0, 0);
1637 return 0;
1639 default:
1640 if ((message >= WM_USER) && (message < WM_APP))
1641 ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam );
1642 return DefWindowProcW(hwnd, message, wParam, lParam);
1647 /***********************************************************************
1648 * SYSLINK_Register [Internal]
1650 * Registers the SysLink window class.
1652 VOID SYSLINK_Register (void)
1654 WNDCLASSW wndClass;
1656 ZeroMemory (&wndClass, sizeof(wndClass));
1657 wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW;
1658 wndClass.lpfnWndProc = SysLinkWindowProc;
1659 wndClass.cbClsExtra = 0;
1660 wndClass.cbWndExtra = sizeof (SYSLINK_INFO *);
1661 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
1662 wndClass.lpszClassName = WC_LINK;
1664 RegisterClassW (&wndClass);
1668 /***********************************************************************
1669 * SYSLINK_Unregister [Internal]
1671 * Unregisters the SysLink window class.
1673 VOID SYSLINK_Unregister (void)
1675 UnregisterClassW (WC_LINK, NULL);