Source code of Windows XP (NT5)
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.

100 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. AlrtInfo.c
  5. Abstract:
  6. This file contains NetpAlertStructureInfo().
  7. Author:
  8. John Rogers (JohnRo) 08-Apr-1992
  9. Environment:
  10. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  11. Requires ANSI C extensions: slash-slash comments, long external names.
  12. Revision History:
  13. 08-Apr-1992 JohnRo
  14. Created.
  15. --*/
  16. // These must be included first:
  17. #include <windef.h> // IN, DWORD, etc.
  18. #include <lmcons.h> // LM20_ equates, NET_API_STATUS, etc.
  19. // These may be included in any order:
  20. #include <debuglib.h> // IF_DEBUG().
  21. #include <lmerr.h> // NO_ERROR, ERROR_ and NERR_ equates.
  22. #include <lmalert.h> // ALERT_xxx_EVENT equates.
  23. #include <netdebug.h> // NetpKdPrint(()), FORMAT_ equates.
  24. #include <netlib.h> // NetpSetOptionalArg().
  25. #include <rxp.h> // MAX_TRANSACT_ equates.
  26. #include <strucinf.h> // My prototype.
  27. #include <tstr.h> // STRICMP().
  28. #include <winbase.h> // INFINITE
  29. NET_API_STATUS
  30. NetpAlertStructureInfo(
  31. IN LPTSTR AlertType, // ALERT_xxx_EVENT string (see <lmalert.h>).
  32. OUT LPDWORD MaxSize OPTIONAL,
  33. OUT LPDWORD FixedSize OPTIONAL
  34. )
  35. {
  36. //
  37. // AlertType is a required parameter.
  38. //
  39. if (AlertType == NULL) {
  40. return (NERR_NoSuchAlert);
  41. } else if ( (*AlertType) == TCHAR_EOS ) {
  42. return (NERR_NoSuchAlert);
  43. }
  44. //
  45. // For some alerts, any amount of variable-length data is OK.
  46. // Set MaxSize to INFINITE for those.
  47. //
  48. if (STRICMP( AlertType, ALERT_ADMIN_EVENT ) == 0) {
  49. NetpSetOptionalArg( FixedSize, sizeof(ADMIN_OTHER_INFO) );
  50. NetpSetOptionalArg( MaxSize, INFINITE );
  51. } else if (STRICMP( AlertType, ALERT_ERRORLOG_EVENT ) == 0) {
  52. NetpSetOptionalArg( FixedSize, sizeof(ERRLOG_OTHER_INFO) );
  53. NetpSetOptionalArg( MaxSize, sizeof(ERRLOG_OTHER_INFO) );
  54. } else if (STRICMP( AlertType, ALERT_MESSAGE_EVENT ) == 0) {
  55. NetpSetOptionalArg( FixedSize, 0 );
  56. NetpSetOptionalArg( MaxSize, INFINITE );
  57. } else if (STRICMP( AlertType, ALERT_PRINT_EVENT ) == 0) {
  58. NetpSetOptionalArg( FixedSize, sizeof(PRINT_OTHER_INFO) );
  59. NetpSetOptionalArg( MaxSize, INFINITE );
  60. } else if (STRICMP( AlertType, ALERT_USER_EVENT ) == 0) {
  61. NetpSetOptionalArg( FixedSize, sizeof(USER_OTHER_INFO) );
  62. NetpSetOptionalArg( MaxSize,
  63. sizeof(USER_OTHER_INFO)
  64. + ((UNLEN+1 + MAX_PATH+1) * sizeof(TCHAR)) );
  65. } else {
  66. return (NERR_NoSuchAlert);
  67. }
  68. return (NO_ERROR);
  69. } // NetpAlertStructureInfo