<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Replace deprecated WinAPI functions with their recommended substitutions"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=122034">122034</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Replace deprecated WinAPI functions with their recommended substitutions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Keywords</th>
          <td>easyHack, skillCpp, skillWindows
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mikekaganski@hotmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Throughout the Win-specific part of the codebase, we have some deprecated
WinAPI functions used. For example, CreateDIBPatternBrush [1] is used in GDI
code. This might have different degree of consequences, from performance
(deprecated functions are most probably internally implemented as wrappers over
up-to-date API, with inevitable overhead; some obsolete API requires more
processing, like using GlobalAlloc to obtain memory handle for
CreateDIBPatternBrush), to possible loss of compatibility/functionality (some
of obsolete functions may not support some newer OS functions).

This easy hack is about looking through the WinAPI functions used in the code,
and checking if they are obsoleted by some newer/recommended API, and
ultimately replacing those deprecated functions (with required modifications
around that).

This requires first obtaining the list of such functions. This might be done
e.g. using tools like Dependencies, [2] which can list imports of a module:

<span class="quote">> C:\Dependencies_x64_Release\Dependencies.exe -imports c:\lo\core\instdir\program\gdipluscanvaslo.dll</span >

and analyzing the output related to system libraries (KERNEL32.DLL, GDI32.DLL,
etc).

Then, reading of the identified functions' documentation is required. [3] For
each deprecated function found, the place where it's used should be found in
the codebase. Some of the usages might come from external libraries; this easy
hack is only about internal usages.

Not every usage of a deprecated function might require replacement; I cannot
come with an example when it might be undesirable, but it is possible. So when
reading the documentation, one must pay close attention to details about
differences in behavior of the obsolete and recommended APIs.

[1]
<a href="https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-createdibpatternbrush">https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-createdibpatternbrush</a>
[2] <a href="https://github.com/lucasg/Dependencies">https://github.com/lucasg/Dependencies</a>
[3] <a href="https://docs.microsoft.com/en-us/windows/desktop/api/index">https://docs.microsoft.com/en-us/windows/desktop/api/index</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>