code: def get_win_folder_via_ctypes(csidl_name: str) -> str:
      """Get folder with ctypes."""
      csidl_const = {
          "CSIDL_APPDATA": 26,
          "CSIDL_COMMON_APPDATA": 35,
          "CSIDL_LOCAL_APPDATA": 28,
          "CSIDL_PERSONAL": 5,
      }.get(csidl_name)
      if csidl_const is None:
          raise ValueError(f"Unknown CSIDL name: {csidl_name}")
  
      buf = ctypes.create_unicode_buffer(1024)
      windll = getattr(
          ctypes, "windll"
      )  # noqa: B009 # using getattr to avoid false positive with mypy type checker
      windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
  
      # Downgrade to short path name if it has highbit chars.
      if any(ord(c) > 255 for c in buf):
          buf2 = ctypes.create_unicode_buffer(1024)
          if windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
              buf = buf2
  
      return buf.value
  
imports: from __future__ import annotations
  import ctypes
  import os
  import sys
  from functools import lru_cache
  from typing import Callable
  from .api import PlatformDirsABC
label_desc: Use image node_id 3 for calling a global function with example usage: get_win_folder_via_ctypes(csidl_name) and returns: buf