private String setExtraCommentForMenuResource(Data data) throws MemoryAccessException {

		short MF_POPUP = 0x0010;
		short MF_END = 0x0080;

		DumbMemBufferImpl buffer = new DumbMemBufferImpl(data.getMemory(), data.getAddress());

		StringBuilder comment = new StringBuilder();
		if (data.getBaseDataType().getName().equals("MenuResource")) {

			short menuItemOption = 0;
			Stack<Short> parentItemOptions = new Stack<>();
			parentItemOptions.push((short) 0);

			int numComponents = data.getNumComponents();
			for (int i = 0; i < numComponents; i++) {
				DataType dt = data.getComponent(i).getBaseDataType();
				int offset = data.getComponent(i).getRootOffset();

				if (dt.getName().equals("MENUITEM_TEMPLATE_HEADER")) {

					int version = buffer.getShort(offset);
					if (version != 0x0000) {
						return null;
					}

					int menuItemOffset = buffer.getShort(offset + 2);
					if (menuItemOffset < 0) {
						return null;
					}

				}
				if (dt.getName().equals("word")) {
					menuItemOption = buffer.getShort(offset);

					if ((menuItemOption & MF_POPUP) == 0) {
						i++; //skip the mtID
					}
				}

				if (dt.getName().equals("unicode")) {
					int depth = parentItemOptions.size() - 1;
					if (depth == 0) {
						comment.append("\n");
					}
					else {
						comment.append(" ".repeat(2 * depth));
					}

					String menuString = fixupStringRepForDisplay(
						data.getComponentContaining(offset).getDefaultValueRepresentation());
					menuString = menuString.replaceAll("\"", "");
					if (menuString.equals("")) {
						comment.append("-------------------\n");
					}
					else {
						comment.append(menuString + "\n");
					}

					if ((menuItemOption & MF_POPUP) == MF_POPUP) {
						// Increase the current depth
						parentItemOptions.push(menuItemOption);
					}
					else if ((menuItemOption & MF_END) == MF_END) {
						// Decrease the current depth until we have found a parent menu item that isn't the last item in its parent
						short parentOptions = parentItemOptions.pop();
						while ((parentOptions & MF_END) == MF_END) {
							parentOptions = parentItemOptions.pop();
						}
					}

				}

			}

		}
		return comment.toString();

	}
Gets a program property name to represent PE resource property with the given key name

@param key The key name
@return A program property name to represent PE resource property with the given key name
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ResourceDataDirectory.java