diff -urN petsc-3.18.3/src/sys/utils/memc.c.orig petsc-3.18.3/src/sys/utils/memc.c
--- petsc-3.18.3/src/sys/utils/memc.c.orig	2022-10-01 06:12:21.000000000 +0200
+++ petsc-3.18.3/src/sys/utils/memc.c	2023-01-27 10:55:03.016594800 +0100
@@ -81,9 +81,17 @@
   hwloc_topology_load(topology);
   set = hwloc_bitmap_alloc();
 
+#ifdef _WIN32
+  PetscCallExternal(hwloc_get_proc_cpubind, topology, GetCurrentProcess(), set, HWLOC_CPUBIND_PROCESS);
+#else
   PetscCallExternal(hwloc_get_proc_cpubind, topology, getpid(), set, HWLOC_CPUBIND_PROCESS);
+#endif
   PetscCall(PetscViewerASCIIPushSynchronized(viewer));
+#ifdef _WIN32
+  PetscCall(PetscViewerASCIISynchronizedPrintf(viewer, "MPI rank %d Process id: %lu coreid %d\n", rank, GetCurrentProcessId(), hwloc_bitmap_first(set)));
+#else
   PetscCall(PetscViewerASCIISynchronizedPrintf(viewer, "MPI rank %d Process id: %d coreid %d\n", rank, getpid(), hwloc_bitmap_first(set)));
+#endif
   PetscCall(PetscViewerFlush(viewer));
   hwloc_bitmap_free(set);
   hwloc_topology_destroy(topology);
