static unsafe ItemsSafeHandle GenerateItemsWrapper(out IntPtr items, out int itemsCount) { ItemsSafeHandle itemsHandle; if (!ServiceControl.GenerateItems(out itemsHandle, out items, out itemsCount)) { throw new InvalidOperationException(); } return(itemsHandle); }