ret, _, _ := syscall.Syscall(pdhLookupPerfIndexByName, 3, 0, uintptr(unsafe.Pointer(nameUTF16)), uintptr(unsafe.Pointer(&idx)))
** Copyright (C) 2001-2025 Zabbix SIA
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
"golang.org/x/sys/windows"
"golang.zabbix.com/sdk/log"
PDH_CSTATUS_VALID_DATA = 0x00000000
PDH_CSTATUS_NEW_DATA = 0x00000001
PDH_CSTATUS_INVALID_DATA = 0xC0000BBA
PDH_MORE_DATA = 0x800007D2
PDH_INVALID_DATA = 0xc0000bc6
PDH_CALC_NEGATIVE_DENOMINATOR = 0x800007D6
PDH_FMT_DOUBLE = 0x00000200
PDH_FMT_LARGE = 0x00000400
PDH_FMT_NOCAP100 = 0x00008000
PDH_MAX_COUNTER_NAME = 1024
objectListSizeInit = 16384
NegDenomErr = newPdhError(PDH_CALC_NEGATIVE_DENOMINATOR)
hPdh = mustLoadLibrary("pdh.dll")
pdhOpenQuery = hPdh.mustGetProcAddress("PdhOpenQuery")
pdhCloseQuery = hPdh.mustGetProcAddress("PdhCloseQuery")
pdhAddCounter = hPdh.mustGetProcAddress("PdhAddCounterW")
pdhAddEnglishCounter = hPdh.mustGetProcAddress("PdhAddEnglishCounterW")
pdhCollectQueryData = hPdh.mustGetProcAddress("PdhCollectQueryData")
pdhGetFormattedCounterValue = hPdh.mustGetProcAddress("PdhGetFormattedCounterValue")
pdhParseCounterPath = hPdh.mustGetProcAddress("PdhParseCounterPathW")