Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. msgalias.c
  5. Abstract:
  6. This file contains routines for adding and deleting message aliases
  7. when a user logs on/off.
  8. Author:
  9. Dan Lafferty (danl) 21-Aug-1992
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. 21-Aug-1992 danl
  14. created
  15. --*/
  16. // #include <nt.h>
  17. // #include <ntrtl.h>
  18. // #include <nturtl.h>
  19. #include <windows.h>
  20. #define LPTSTR LPWSTR
  21. #include <lmcons.h>
  22. #include <lmerr.h>
  23. #include <lmmsg.h>
  24. #include <stdlib.h>
  25. #include <msgalias.h>
  26. #include <strsafe.h>
  27. VOID
  28. AddMsgAlias(
  29. LPWSTR Username
  30. )
  31. /*++
  32. Routine Description:
  33. This function adds the Username to the list of message aliases.
  34. If unsuccessful, we don't care.
  35. Arguments:
  36. Username - This is a pointer to a unicode Username.
  37. Return Value:
  38. none.
  39. --*/
  40. {
  41. HANDLE dllHandle;
  42. PMSG_NAME_ADD NetMessageNameAdd = NULL;
  43. dllHandle = LoadLibraryW(L"netapi32.dll");
  44. if (dllHandle != NULL) {
  45. NetMessageNameAdd = (PMSG_NAME_ADD) GetProcAddress(
  46. dllHandle,
  47. "NetMessageNameAdd");
  48. if (NetMessageNameAdd != NULL) {
  49. NetMessageNameAdd(NULL,Username);
  50. }
  51. FreeLibrary(dllHandle);
  52. }
  53. }