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.

88 lines
3.2 KiB

  1. Minutes of the WINPROF code review
  2. 1/17/91 9-11a
  3. attending: ANNMC CHUCKC JIMH JONN
  4. Minutes by JONN
  5. -- THE FOLLOWING OBSERVATION IS IMPORTANT TO ALL WINDOWS PROGRAMMERS:
  6. WinProf and the other modules reviewed frequently allocate objects on the
  7. stack, then pass these objects by far reference to other procedures. This
  8. is dangerous where the called procedure could use Windows APIs or
  9. lose control to Windows.
  10. WINDOWS AND THE WINDOWS APIS CAN RELOCATE THE STACK SEGMENT!
  11. This means that the far pointer passed to the called procedure may be
  12. invalidated by a Windows call. Remember that constructors and
  13. destructors are also called procedures, and that the implicit
  14. parameter "this" is passed by far reference.
  15. This occurs in this scenario:
  16. - Large Model (or where far pointers are used),
  17. - when objects are allocated on the stack,
  18. - when pointers to those objects are passed to procedures,
  19. - when those procedures call Windows APIs or lose control to Windows,
  20. - and the stack segment is not locked,
  21. - under Real Mode.
  22. In particular, BLT dialog objects are often allocated this way.
  23. Rustan says that he will fix DIALOG_WINDOW::Process() to
  24. automatically lock the stack segment for the duration of the
  25. Process() call. A different approach to fixing the problem could be
  26. to allocate just a pointer on the stack, then allocate the object
  27. with New; heap objects are always locked.
  28. -- These modules, and all Windows modules which must run under Real Mode,
  29. should be unit-tested under real mode. If it survives, try again
  30. while running Shaker.
  31. -- General Windows coding practice: For every routine, specify whether it
  32. calls Windows APIs which could potentially move memory. In
  33. particular, routines which do not take hParent arguments but which
  34. can move memory should be clearly marked. Routines which do not and
  35. will never call Windows APIs should not take an hParent argument.
  36. -- We should resolve the problem with the two versions of CFGFILE,
  37. either by upgrading UserProfile to use the new versions, or by
  38. supporting the old version. CHUCKC will look into this.
  39. -- CHRISG has observed a speed problem where NetGetDCName is repeated
  40. when PROFILE::Read fails. This should be fixed so that PROFILE::Read
  41. caches an empty profile even when it fails. Thus, the first
  42. PROFILE::* call will fail if the profile is inaccessible, but subsequent
  43. calls will use the (empty) cached profile.
  44. -- Callers of WinNet's MapError should not assume that
  45. (usNetErr != 0) => (wWnErr != 0).
  46. -- Enable the WNetRestoreConnections bit in WNetGetCaps. WNRC(0) should
  47. fail, only WNRC(1) is supported.
  48. -- We should disable WNetAddConnection, ifdef out its code (return
  49. WN_NOT_SUPPORTED), disable its WNetGetCaps bit.
  50. -- JONN should upgrade to Win31 beta as soon as a semi-stable version is
  51. available which runs Net APIs.
  52. -- JONN should check: Does SetNetError also prepare the error text?
  53. -- JONN should file a Sev 4 bug against the use of locked memory for
  54. the user profile cache in UserProfile under Windows.
  55. -- CHUCKC will look into the possibility of caching the DC name.
  56. -- The pnlsUNCResourceName parameter to PROFILE::Load should be removed
  57. as it is never used.